#C1596. Decoding the Caesar Cipher
Decoding the Caesar Cipher
Decoding the Caesar Cipher
You are given an encoded message that has been encrypted using a Caesar cipher. In this cipher, each uppercase letter in the message is shifted backwards by a fixed key value in the alphabet. The shift wraps around so that if the shift goes before 'A', it continues from 'Z'.
Your task is to decode the message by reversing the shift. For example, if the encoded message is KHOOR
and the key is 3
, the decoded message will be HELLO
.
inputFormat
The first line of input contains an integer T denoting the number of test cases. Each of the next T lines contains an encoded message (a string of uppercase letters) followed by an integer key separated by a space.
outputFormat
For each test case, output the decoded message on a new line.
## sample4
KHOOR 3
ZRUOG 3
BCD 1
A 1
HELLO
WORLD
ABC
Z
</p>