137. Cryptography

Problem Statement:
Cryptography is an important field for military purposes, it's important because transferring secret messages in wars is very critical, so we need these messages to stay secret even if it is caught by the enemy.

Cesar invented an idea to encode a letter using a key (an integer m) and replaces each character with the m-th next character, for example if m=6 we replace 'A' with 'G', and if m=5 we replace 'w' with 'b' (because we assume that the letter after 'z' is 'a'). Then we replace each lower case character with the same character but in upper case (for example, 'a' to 'A'), and we replace each upper case character with the same character but in lower case (for example, 'A' to 'a').

Given a sentence of n words, your task is to output the encoded sentence.

Input Format:
The first line of the input contains an integer t, the number of test cases. Followed by t test cases. Each test case starts with a line contains two integers n and m, the number of the words in the sentence and the cryptography key, respectively (1 ≤ n ≤ 10) and (0 ≤ m ≤ 1000). Followed by a line which contains n non-empty strings separated by single space which represent the sentence. Each word will consist of up to 20 English characters (from 'a' to 'z' or from 'A' to 'Z').

Output Format:
For each test case print a line which contains the n words separated by single space, but encoded as described above.

Sample Input:
2 5 3 NODAR likes Cryptography so much 3 36 I love You

Sample Output:
qrgdu OLNHV fUBSWRJUDSKB VR PXFK s VYFO iYE

 Added by: alaa.jrad Added at: 2014-03-05 18:59:29 UTC Time Limit: 2 seconds Partial score: No Source: Tishreen University First Training Contest 2014