Error
|
|
---|---|
@Ibrahim Nash | 5761 |
@blackshadows | 5701 |
@akhayrutdinov | 5111 |
@mb1973 | 4989 |
@Quandray | 4944 |
@saiujwal13083 | 4506 |
@sanjay05 | 3762 |
@marius_valentin_dragoi | 3516 |
@sushant_a | 3459 |
@verma_ji | 3341 |
@KshamaGupta | 3318 |
Complete Leaderboard | |
|
|
@aroranayan999 | 938 |
@bt8816103042 | 739 |
@SHOAIBVIJAPURE | 428 |
@codeantik | 412 |
@SherlockHolmes3 | 407 |
@neverevergiveup | 348 |
@mahlawatep | 347 |
@shalinibhataniya1097 | 343 |
@murarry3625 | 333 |
@saiujwal13083 | 326 |
@rohitanand | 314 |
Complete Leaderboard |
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.
Input:
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.
Output:
Print the character at the Kth position in the original string.
Constraints:
1 <= T <= 100
2 <= N <= 30
1 <= K <= N
Examples:
Input:
1
jon2snow3
8
Output:
n
Explanation:
Testcase1: The given string after decoding it will be as such: jonjonsnowjonjonsnowjonjonsnow. 8th character in string after decoding is: 'n'.
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Yes