#K51937. String Encryption via Caesar Cipher
String Encryption via Caesar Cipher
String Encryption via Caesar Cipher
In this problem, you are given a shift value and a string composed of lowercase English letters. Your task is to encrypt the string using a Caesar Cipher. In a Caesar Cipher, each letter is shifted by a specified value. The encryption formula is given in \(\LaTeX\) by:
\( new\_char = ((old\_char - 'a' + shift) \mod 26) + 'a' \)
You will be provided with multiple test cases. For each test case, you must read the shift value and the string from the standard input, perform the encryption, and print the encrypted string on a new line.
inputFormat
The input is read from the standard input and has the following format:
- The first line contains an integer \(T\), the number of test cases.
- Each test case consists of two lines:
- The first line contains a non-negative integer \(shift\) (the shift amount).
- The second line contains a string \(s\) of lowercase letters. The string may be empty.
outputFormat
For each test case, output the encrypted string on a separate line. The encryption is performed by shifting each character in \(s\) by the shift value modulo 26, according to the formula provided.
## sample2
3
abcde
2
xyz
defgh
zab
</p>