{"problem":{"name":"191. Morbit Cipher Encryption","description":{"content":"You're trying to encrypt text using the Morbit Cipher, a cipher involving morse code. Encrypting text using the Morbit Cipher involves several steps: 1. Convert the text to Morse Code. This involves","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10269191"},"statements":[{"statement_type":"Markdown","content":"You're trying to encrypt text using the Morbit Cipher, a cipher involving morse code.\n\nEncrypting text using the Morbit Cipher involves several steps:\n\n1. Convert the text to Morse Code. This involves converting all letters to their Morse Code equivalents, and placing a lowercase x letter in between two letters, and two lowercase x letters in between two words. See below for a list of morse code mappings which you can copy into your program.\n\n2. Divide the Morse Code into blocks of two characters each. If there are an odd number of characters, add an \"x\" to the end of the Morse Code. There are now 9 total combinations of two-character blocks, since each position can have three possible characters (dot, dash, and \"x\").\n\n3. Write each of the 9 combinations of two-character blocks in an arbitrary order, assigning each one to an integer from 1 to 9. This is the \"key\" of the cipher.\n\n4. Replace each two-character block in the Morse Code text of the cipher with the number it corresponds to in the key.\n\n5. You should now have a long sequence of numbers from 1-9. Now, your text is encrypted using the Morbit Cipher.\n\nHere is a comma-separated list of the Morse Code equivalents of each letter from A to Z, in order. You can copy this into your program: \n\n\".-\", \"-...\", \"-.-.\", \"-..\", \".\", \"..-.\", \"–.\", \"....\", \"..\", \".—\", \"-.-\", \".-..\", \"–\", \"-.\", —\", \".–.\", \"–.-\", \".-.\", \"...\", \"-\", \"..-\", \"...-\", \".–\", \"-..-\", \"-.–\", \"–..\"\n\nThe first line of input contains a line of text, consisting of only lowercase characters and spaces: the plaintext to encrypt using the Morbit Cipher.\n\nThe next 9 lines each contain a two-character block: the first one corresponds to the block that maps to \"1\", the second one corresponds to the block that maps to \"2\", and so on.\n\nOutput a single string of numbers from 1 to 9: the plaintext, after applying the Morbit Cipher on it using the given key.\n\n## Input\n\nThe first line of input contains a line of text, consisting of only lowercase characters and spaces: the plaintext to encrypt using the Morbit Cipher.The next 9 lines each contain a two-character block: the first one corresponds to the block that maps to \"1\", the second one corresponds to the block that maps to \"2\", and so on.\n\n## Output\n\nOutput a single string of numbers from 1 to 9: the plaintext, after applying the Morbit Cipher on it using the given key.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ P $ be the plaintext string, consisting of lowercase letters and spaces.  \nLet $ M: \\{a, b, \\dots, z\\} \\to \\{\\text{\".-\", \"-...\", \\dots, \"--..\"}\\} $ be the fixed Morse code mapping for letters.  \nLet $ \\text{space} \\mapsto \"xx\" $.  \nLet $ \\text{char}_i \\in \\{ \\text{\".\", \"-\", \"x\"} \\} $ denote the set of valid Morse symbols.\n\n**Constraints**  \n1. $ P $ contains only lowercase English letters and spaces.  \n2. The Morse code for each letter is as provided; between letters: insert \"x\"; between words: insert \"xx\".  \n3. The Morse string $ M(P) $ is padded with an trailing \"x\" if its length is odd.  \n4. The key is a bijection $ K: \\{ \\text{all 2-character combinations of } \\{., -, x\\} \\} \\to \\{1, 2, \\dots, 9\\} $, given as 9 input lines, each a 2-char block, in order from 1 to 9.\n\n**Objective**  \n1. Convert $ P $ to Morse string $ S $ using:  \n   - $ \\text{letter} \\to M(\\text{letter}) $,  \n   - $ \\text{letter} \\to \\text{letter} $: insert \"x\" between them,  \n   - $ \\text{word} \\to \\text{word} $: insert \"xx\" between them.  \n2. Pad $ S $ with \"x\" if $ |S| $ is odd.  \n3. Split $ S $ into consecutive 2-character blocks $ B_1, B_2, \\dots, B_m $.  \n4. For each block $ B_i $, output $ K(B_i) \\in \\{1,2,\\dots,9\\} $.  \n5. Output the concatenation of all $ K(B_i) $ as a single string of digits.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10269191","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}