#t125. 凯撒密码
凯撒密码
Caesar Cipher
Problem Description
The Caesar cipher is a substitution cipher in which every letter in the plaintext is shifted a fixed number of positions forward (or backward) in the alphabet and replaced by the corresponding letter in the ciphertext. For example, when the shift is , every letter A is replaced by D, B by E, C by F, and so on; W is replaced by Z, X by A, Y by B, Z by C. This encryption method is named after Julius Caesar, the Roman general, who is said to have used it to communicate with his generals.
But like all substitution ciphers based on the alphabet, the Caesar cipher is very easy to break, and it cannot guarantee communication security in practice.
Now you are given a cracked Caesar-cipher plaintext and its ciphertext, together with an uncracked Caesar-cipher ciphertext that uses the same shift. Please help crack it.
Input Format
The input consists of three lines:
- The first line contains a string, the cracked Caesar-cipher plaintext;
- The second line contains a string, the Caesar-cipher ciphertext corresponding to the first line;
- The third line contains a string, the Caesar-cipher ciphertext to be cracked.
Output Format
Output one line containing a string: the plaintext corresponding to the ciphertext to be cracked.
Sample Input
ABCDEFGVWXYZ
DEFGHIJYZABC
WKHTXLFNEURZQIRAMXPSVRYHUWKHODCBGRJ
Sample Output
THEQUICKBROWNFOXJUMPSOVERTHELAZYDOG
Sample Explanation
From the first line of plaintext ABCDEFGVWXYZ and the second line of ciphertext DEFGHIJYZABC we can compute that the shift is (for example, the letter A becomes D, and D is positions after A in the alphabet). Therefore, applying the same reverse shift (i.e. moving each letter backward by positions) to the third line's ciphertext to be cracked: W moves back positions to become T, K moves back to become H, and so on, finally yielding the plaintext THEQUICKBROWNFOXJUMPSOVERTHELAZYDOG.
Constraints
The lengths of all strings do not exceed , and all strings consist of uppercase letters.