#K80512. Caesar Cipher Encryption

    ID: 35547 Type: Default 1000ms 256MiB

Caesar Cipher Encryption

Caesar Cipher Encryption

You are given an integer T representing the number of test cases. For each test case, you are provided with an integer shift value S and a message consisting solely of lowercase English letters. Your task is to encode the message using the Caesar Cipher method.

The encryption is defined by the formula:

$$ encoded = \text{chr}(((\text{ord}(c)-\text{ord}('a')+S) \mod 26) + \text{ord}('a')) $$

where c is a character in the original message. The cipher shifts each letter by S positions, wrapping around the alphabet if necessary.

Note: The shift value S can be positive, negative, or zero.

inputFormat

The input is read from stdin and has the following format:

T
S1 M1
S2 M2
... 
ST MT

Where:

  • T is an integer representing the number of test cases.
  • Each following line contains an integer S (the shift value) and a string M (the message) separated by a space.

outputFormat

For each test case, output the encoded message on a separate line to stdout.

## sample
3
3 hello
-2 world
1 zebra
khoor

umpjb afcsb

</p>