Loading...
Akash and Cipher
Time: 1 s
Memory: 500 MB
Once upon a time, there were two friends, Avra and Akash. They become bored with their studies and exams, so they decide to do something to refresh their minds. Avra tells Akash that he has an idea. He challenges Akash to solve a cipher problem. If Akash wins the challenge, Avra will give him a brand-new iPhone. But if Akash fails, he has to give Avra a new iPhone. At this moment, Akash doesn’t have enough money to buy an iPhone, but he decides to take the risk. Avra gives two strings of the same length to Akash and asks him to decrypt the message. The first string contains smaller Latin letters (case sensitive), and the second string only contains ‘U’ and ‘D’. ‘U’ means shift up, and ‘D’ means shift down. Akash has to shift the ith letter exactly i amounts upward or downward. If the ith character in the second string is ‘U’, then the ith character of the first string is shifted i amount upward. On the other hand, if the ith character in the second string is ‘D’, then the ith character of the first string is shifted i amount downward.
Akash is not good at solving this type of problem, but now he is in danger because he has taken the challenge. Write a program to solve this problem and save Akash from this danger.
Input
The first line of the input contains an integer T (1 <= T <= 10^5), the number of test cases.
The following three lines will contain an integer n (1 <= n <= 10^5), the length of the string, a string s, that contains the smaller Latin letter, and another string q, that contains only ‘U’ and ‘D’.
It’s guaranteed that the sum of the length of strings over all test cases doesn't exceed 10^6.
 
Output
You have to print a line, the output for each test case.
Examples
Input
Output
2
2
gk
UD
5
mmlyj
UUDUD
hi
noice
Notes
In the first test case, the first string is “gk,” and the second string is “UD.” The first letter of the first string is ‘g,’ and the first character in the second string is ‘U.’ So, the first letter of the first string will shift 1 upward and become ‘h.’ The second letter of the first string is ‘k,’ and the second character of the second string is ‘D.’ So, the second letter of the first string will shift 2 downward and become ‘i.’ So, the final output of the first test case is “hi”.
Problem Info
Problem ID 195
Time Limit 1000 ms
Memory Limit 512000 KB
Moderators bijoy404 , Alom_Shanto , Falak_Ahmed_Shakib
Statistics
Submit
You need to Login or Registration for submit your solution