| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 37 | 29 | 27 | 77.143% |
We've come up with a new encryption method we call Leapfrog Encryption. It is a key-based encryption scheme where an alphabetic key specifies how letters in the plaintext (the text to be encrypted) are placed in the ciphertext (the resulting encrypted string). Here's how Leapfrog Encryption works:
a' converts to $2$, 'b' converts to $3$ and so on). This gives us a sequence of numbers $d_1, d_2, \ldots, d_n$ where $n$ is the length of the key.For example, if our plaintext is "Send more monkeys!" and our key is "bea", the encryption proceeds as follows:
| b $\rightarrow$ 3, left-to-right: | _ _ s _ _ e _ _ n _ _ d _ _ m |
| e $\rightarrow$ 6, right-to-left: | _ _ s _ _ e o _ n _ _ d _ _ m |
| a $\rightarrow$ 2, left-to-right: | _ r s _ e e o _ n m _ d o _ m |
| last pass, right-to-left: | s r s y e e o e n m k d o n m |
Decryption is done by $\ldots$ hey, you know what? We're going to let you figure that out.
The first line of input contains two strings $t$ $k$ where $t$ is either E or D indicating whether to perform encryption or decryption and $k$ is the lowercase alphabetic key. The length of $k$ will be between $1$ and $100$, inclusive. The second and final line of input contains the plaintext to encrypt (if $t$ is E) or the ciphertext to decrypt (if $t$ is D). This string is non-empty and has a maximum length of $2\,000$. A ciphertext string consists of lowercase letters only, while a plaintext string may contain uppercase letters, numbers, punctuation and spaces as well (all counted as part of the length of the string) and is guaranteed to contain at least one letter.
Output the encrypted or decrypted text. Your output should only contain lowercase letters.
E bea Send more monkeys!
srsyeeoenmkdonm
D bea srsyeeoenmkdonm
sendmoremonkeys
D zyxwvutsrqponmlkjihgfedcba lafogrpe
leapfrog
ICPC > Regionals > North America > East Central North America Regional > 2024 East Central NA Regional Contest F번
ICPC > Regionals > North America > Greater New York Region > 2024 Greater New York Regional Contest F번
ICPC > Regionals > North America > Northeast North America Regional > 2024 Northeast North America Regional Contest F번