Overview
As most of y'all who visit chat know, I am Russian by ethnicity[citation not needed]. Recently, I switched from a keyboard that maps the letters 1-to-1 (mnemonic) to Windows' default mnemonic keyboard. Here are the letter mappings:
"`" -> "ъ"
"q" -> "я"
"w" -> "ш"
"e" -> "е"
"r" -> "р"
"t" -> "т"
"u" -> "у"
"i" -> "и"
"o" -> "о"
"p" -> "п"
"a" -> "а"
"d" -> "д"
"f" -> "ф"
"g" -> "г"
"h" -> "х"
"k" -> "к"
"l" -> "л"
"'" -> "ь"
"z" -> "з"
"x" -> "ж"
"v" -> "в"
"b" -> "б"
"n" -> "н"
"m" -> "м"
You may have notcied that s, c, y, and j are missing. This keyboard, unlike the first one I used, has several combining keys (the aforementioned ones) These keys, while also having their own letters mapped to them, can be combined with other keys in sequence to write even more letters. The combinations for those keys are as follows:
"sc" -> "щ"
"ch" -> "ч"
"ya" -> "я"
"ye" -> "э"
"yo" -> "ё"
"yu" -> "ю"
"ja" -> "я"
"je" -> "э"
"jo" -> "ё"
"ju" -> "ю"
Note that there are 3 ways to write я
: q
, ya
, and ja
.
To type the single letters mapped to them, either press that key and then press space, or type an unrecognised key combination. Here are the single letter mappings for those keys:
"s" -> "с"
"c" -> "ц"
"y" -> "ы"
"j" -> "й"
For example, if I type in c
(note the space), it will give me ц
, while typing in cy
gives me цы
. Typing in yosc
is ёщ
, and yq
is ыя
.
The task
Your input will be given as all lowercase Russian + ASCII space, and you task is to convert that to a sequence of letters in the US keyboard I'd have to type.
Testcases
"один" (one) -> "odin"
"стапятидесятитрёхтысячный" (one hundered fifty three thousandth) -> "stapqtidesqtitryohtysqchnyj" or "stapyatidesyatitryohtysjachnyj" or any variation on the typing of "я" or "ё"
"код гольф" (code golf) -> "kod gol'f"
"иван рубит дрова вова топит печь" (Ivan is splitting wood, Vova is stoking the stove; a common mnemonic for the six noun cases) -> "ivan rubit drova vova topit pech'"
"разъяренный чтец эгоистично бьёт пятью жердями шустрого фехтовальщика" (An enraged narrator selfishly beats with five poles a nimble fencer; a sentence that uses all 33 Russian letters) -> "raz`yarennyj chtec jegoistichno b'yot pqt'yu xerdyami wustrogo fehtoval'scika" (note the double space after "chtec". I used a mixture of "q" and "ya" for "я" here)
Scoring
As this is code-golf, shortest answer in bytes wins.
chtec
as well, because thej
is a dead key and consumes the first space to becomeй
? Also, are there two ways to writeэ
? \$\endgroup\$y
is a dead key as well. Sinceyj
is unrecognized, it becomesый
. Yes there are two ways to writeэ
andё
, and three to writeя
. You may use any of them. \$\endgroup\$сч
has to bes ch
right? \$\endgroup\$