Codeforces Round 820 (Div. 3) |
---|
Finished |
Polycarp has a string $$$s$$$ consisting of lowercase Latin letters.
He encodes it using the following algorithm.
He goes through the letters of the string $$$s$$$ from left to right and for each letter Polycarp considers its number in the alphabet:
For example, if the string $$$s$$$ is code, then Polycarp will encode this string as follows:
Thus, code of string code is 315045.
You are given a string $$$t$$$ resulting from encoding the string $$$s$$$. Your task is to decode it (get the original string $$$s$$$ by $$$t$$$).
The first line of the input contains an integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of test cases in the input.
The descriptions of the test cases follow.
The first line of description of each test case contains one integer $$$n$$$ ($$$1 \le n \le 50$$$) — the length of the given code.
The second line of the description of each test case contains a string $$$t$$$ of length $$$n$$$ — the given code. It is guaranteed that there exists such a string of lowercase Latin letters, as a result of encoding which the string $$$t$$$ is obtained.
For each test case output the required string $$$s$$$ — the string that gives string $$$t$$$ as the result of encoding. It is guaranteed that such a string always exists. It can be shown that such a string is always unique.
963150454110071213121612012018315045615018035190711111107111110051111142606
code aj abacaba ll codeforces aaaak aaaaj aaaaa zf
The first test case is explained above.
In the second test case, the answer is aj. Indeed, the number of the letter a is equal to $$$1$$$, so 1 will be appended to the code. The number of the letter j is $$$10$$$, so 100 will be appended to the code. The resulting code is 1100.
There are no zeros in the third test case, which means that the numbers of all letters are less than $$$10$$$ and are encoded as one digit. The original string is abacaba.
In the fourth test case, the string $$$s$$$ is equal to ll. The letter l has the number $$$12$$$ and is encoded as 120. So ll is indeed 120120.
Name |
---|