Trivial Encryption
You and your friends are trying to send messages to each other in a more secure manner. Thus, you have adopted the STC (Super Trivial Cipher) encryption scheme for your messages! This encryption scheme takes two uppercase and strictly alphabetical string inputs: a message \(S\), and a key \(K\). For every letter \(S_i\) of the message, offset it by the offset of the letter \(K_i\) in the key relative to "A" (mod the length of \(K\)). In other words, "A" corresponds to an offset of 0, "B" to 1, "C" to 2, etc... Please note that in the case any letter exceeds "Z", it should wrap around and start again at "A".
Input
The first line is the string with the message to encrypt \(S\), where the length of \(S\) is less than 10^3 and greater than zero. The second line of input is the key \(K\), whose length will also be less than 10^3 and greater than zero.
Output
Output the encrypted message according to the encryption scheme described above.
Sample Input 1
HELLO
ABC
Sample Output 1
HFNLP
Sample 1 Explanation
"A" corresponds to an offset of 0, "B" corresponds to an offset of 1, and "C" corresponds to an offset of 2. Thus, the offsets for each character of the message would be 0, 1, 2, 0, 1, respectively. This leads to the output of HFNLP.
Sample Input 2
Z
B
Sample Output 2
A
Sample 2 Explanation
"Z" offset by 1 will wrap around to "A".
Comments