A week ago, You had a fatal accident while overspeeding your scooty and were not able to study for today's exam. You want to pass the exam anyhow and have asked your friends to help out. Your friends, being helpful and smart, have decided to write the answers in the washroom in a coded message(S) and give you it's key(K) so that the others are not able to understand the answers and you end up with a better percentile.
The answer is encrypted in the following manner:
- An integer K is chosen as the key.
- All the alphabets(Si) in the answer are shifted K number of places up the alphabet.
You need to find the actual message by using it's given key K.
The first line of the input contains an integer N denoting the number of messages.
2*N lines follow.
The first line of the ith message contains the encrypted string S.
The second line of the ith message contains it's key K.
For each encrypted message, output a string representing the actual message.
- 1 ≤ N ≤ 100
- 1 ≤ |S| ≤ 105
- 0 ≤ K ≤ 100
- Subtask #1[20 points] : All characters in the message are lowercase alphabets
- Subtask #2[30 points] : All characters in the message are alphabetic
- Subtask #3[50 points] : Original constraints
Input: 2 ofyvt 1 Aqw eqwnf jcxg uvwfkgf gctnkgt! 28 Output: nexus You could have studied earlier!
Example case 2. All the lowercase alphabets and uppercase alphabets are replaced by their respective lowercase alphabets and uppercase alphabets according to key.
|Time Limit:||1.5 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.