#K7571. Decoding Caesar Cipher Messages
Decoding Caesar Cipher Messages
Decoding Caesar Cipher Messages
You are given an encoded message which was encoded by shifting each letter backwards by a constant shift value using the Caesar cipher. For a given encoded string s and a positive integer shift value k, the original character c is computed as:
$$ c = \text{chr}(((\text{ord}(s) - \text{ord}('a') - k) \mod 26) + \text{ord}('a')) $$
Your task is to decode the message for multiple test cases. Each test case consists of a single encoded string and an integer shift value. Output the decoded message for each test case on a new line.
Note: The encoding is cyclic. That is, if the shift takes you before 'a', you continue from 'z'.
inputFormat
The first line contains an integer T representing the number of test cases. Each of the following T lines contains an encoded message (a string consisting of lowercase letters) and an integer shift value separated by a space.
outputFormat
For each test case, output the decoded message on a separate line.
## sample3
ifmmp 1
jgnnq 2
lipps 4
hello
hello
hello
</p>