問題一覧 > 通常問題

No.18 Usar Cipher

レベル : / AI推定難易度 : 130 / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 1137
作問者 : なお
お気に入りにしたユーザー ProblemId : 59 / 自分の提出
問題文最終更新日: 2026-06-25 10:44:47
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 18 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。