#K2001. Shifted Message Decoding
Shifted Message Decoding
Shifted Message Decoding
You are given an encoded message for each test case. Each message has been encoded by shifting every letter forward by a specified number. Your task is to decode each message by shifting the letters backwards by the same number.
The decoding is performed using the formula:
$$decoded\_char = ((ord(c) - ord('a') - k) \mod 26) + ord('a'),$$
where c
is an encoded character and k
is the shift value. Note that the alphabet wraps around so that after 'a'
comes 'z'
when shifting backwards.
For example, if k = 2
and the encoded string is "cde"
, then the decoded message is "abc"
.
inputFormat
The input is given via stdin and consists of several lines. The first line contains an integer T, the number of test cases. Each of the following T lines contains an integer k
and a string s
separated by a space. The string s
consists of lowercase English letters.
outputFormat
For each test case, output the decoded message on a separate line to stdout.
## sample1
2 cde
abc
</p>