The russian alphabet includes many letters that are the same in the English alphabet. Here is the list of common letters: L='acekopuxy'
Now, given two huge lists R and E, each in the form [word_A, word_B, ...], where each word_N is a lowercase word, I want to create a list C, which should contain only those words that have the same spelling in E and in R. For example, a word 'cop' must be in C, because it is in the list R as well as in E.
Is there any polynomial way to do it?
P.S.: One important note: because of the different character encodings, there are two L lists, LE for English letters and LR for Russian, but the appearance of their letters is the same:
LE='acekopuxy'
LR='асекориху'