Олимпиадный тренинг

Задача 39457. GROMOZEKA-2


To encode a certain sequence consisting of all capital letters of the Russian alphabet, we decided to use a non-uniform binary code that satisfies the condition that no code word is the beginning of another code word. This condition ensures that encoded messages can be unambiguously decrypted. The code words of the first letters of the alphabet are known: A - 00, B - 01. The remaining letters are encoded in such a way that the code of the subsequence GROMOZEKA has the smallest possible length. Specify the shortest possible code word for the letter O , in which the code will satisfy the specified condition. If there is more than one such code, indicate the code with the smallest numerical value.