No.18 Usar Cipher
タグ : / 解いたユーザー数 1137
作問者 :
Problem Statement
Taro is interested in cryptography and has been thinking about a new encryption scheme.
Taking the Caesar cipher, developed long ago, as a reference,
he came up with the idea of creating a slightly more complex encryption scheme by modifying it a little.
The Caesar cipher takes the letters of the plaintext (the unencrypted text)
and shifts them to the right \(N\) times. For example, when \(N = 1\),
'\(A\)' becomes '\(B\)', '\(M\)' becomes '\(N\)', and '\(Z\)' becomes '\(A\)'.
Taro then thought of changing the value of \(N\) for each character:
\(N = 1\) for the \(1\)st character, \(N = 2\) for the \(2\)nd character, and so on.
That is, he decided to "shift the \(i\)-th character to the right \(i\) times".
(If a shift goes past the letter '\(Z\)', it returns to the letter '\(A\)', just as in the Caesar cipher.)
Shifting to the right means changing a letter to the next letter in alphabetical order.
Taro named this new encryption scheme the "Usar cipher".
You are given as input a string encrypted with the "Usar cipher".
Output the decrypted string.
Input
S
The string S is given on one line (at most 1024 characters).
Each character of the string S is an uppercase letter ('A'-'Z'),
and the decrypted string also consists only of uppercase letters.
Output
The string obtained by decrypting the input string.
Print a newline at the end.
Sample
Sample 1
Input
BCD
Output
AAA
Sample 2
Input
ABCDEFGHIJKLMNOPQRSTUVWXYZ
Output
ZZZZZZZZZZZZZZZZZZZZZZZZZZ
Sample 3
Input
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
Output
YXWVUTSRQPONMLKJIHGFEDCBAZYXWVUTSRQPONMLKJIHGFEDCBAZYXWVUTSRQPONMLKJIHGFEDCBAZYXWVUTSRQPONMLKJIHGFEDCBAZ
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。