049. Decryption

Codeforces
IDCF10269049
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
A monoalphabetic cipher is a type of encryption where each letter in the alphabet correlates to another letter in the alphabet. For this question you need to decrypt a piece of text given the key used to encrypt it and the encrypted message. The first line will be the key needed to decrypted the text and the second line will be the encrypted message. For the key that is given, the first letter of the key correlates to A, the second letter in the the key goes to B, then C and so on. Print the following: "Decrypted text: (Decrypted text)" ## Input The first line will be the key needed to decrypted the text and the second line will be the encrypted message. For the key that is given, the first letter of the key correlates to A, the second letter in the the key goes to B, then C and so on. ## Output Print the following: "Decrypted text: (Decrypted text)" [samples]
**Definitions** Let $ K = (k_1, k_2, \dots, k_{26}) $ be the encryption key, where $ k_i \in \{A, B, \dots, Z\} $ and $ k_i $ is the ciphertext letter corresponding to plaintext letter $ (i-1) $-th letter of the alphabet (i.e., $ k_1 $ maps to 'A', $ k_2 $ to 'B', ..., $ k_{26} $ to 'Z'). Let $ C = c_1 c_2 \dots c_n $ be the encrypted message, where each $ c_j \in \{A, B, \dots, Z\} $. **Constraints** 1. $ K $ is a permutation of the 26 uppercase English letters. 2. $ C $ consists only of uppercase English letters. **Objective** Compute the decrypted message $ P = p_1 p_2 \dots p_n $, where for each $ c_j \in C $: $$ p_j = \text{the } (i)\text{-th letter of the alphabet}, \quad \text{such that } k_i = c_j $$ That is, $ p_j = \text{chr}(\text{ord}('A') + \text{index of } c_j \text{ in } K) $. **Output** "Decrypted text: $ P $"
API Response (JSON)
{
  "problem": {
    "name": "049. Decryption",
    "description": {
      "content": "A monoalphabetic cipher is a type of encryption where each letter in the alphabet correlates to another letter in the alphabet. For this question you need to decrypt a piece of text given the key used",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10269049"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "A monoalphabetic cipher is a type of encryption where each letter in the alphabet correlates to another letter in the alphabet. For this question you need to decrypt a piece of text given the key used...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ K = (k_1, k_2, \\dots, k_{26}) $ be the encryption key, where $ k_i \\in \\{A, B, \\dots, Z\\} $ and $ k_i $ is the ciphertext letter corresponding to plaintext letter $ (i-1) $-th ...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments