An encoded string S consisting of alphabets(lowercase) and integers(1<=num<=9) is given, the task is to decode it and print the character at the 'K'th position in the string. The pattern in which the strings were encoded were as follows :
original string: jonjonsnowjonjonsnowjonjonsnow
encoded string: jon2snow3
Note: encoded string will always start with an alphabet and end with an number.
The first line contains a single integer T i.e. the number of test cases. The First line of each test case consists of a encoded string S. The second line of each test case includes of an integer K.
Print the character at the Kth position in the original string.
1 <= T <= 100
2 <= N <= 30
1 <= K <= N
Testcase1: The given string after decoding it will be as such: jonjonsnowjonjonsnowjonjonsnow. 8th character in string after decoding is: 'n'.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.