Medium Accuracy: 33.67% Submissions: 10132 Points: 4
Pasha is a strange guy. He has a string of length N. He wants to perform 2 types of queries on the string.
Type 1- Rotate the string by K character from the end.
Type 2- Print the Character at the I'th index of the resulting string at that Instant.
Now, Pasha wants to perform the 2 types of queries, But he is too lazy to do it himself.
So, you need to help him. Input:
The first line contains an integer T-denoting the test cases.
The first line of each test cases contains two integers- N (Length of the string) and Q(Number of queries),
The second line contains the String.
Then Each of the next Q lines contains Typ of the query and K or I. Output:
For each query of Type 2, Output the character at the I'th index in a new line. Constraints:
After First query String becomes -"fgabcde"
Second query returns - 'f'
Third query returns -'e'
After Fourth Query String becomes- "bcdefga"
Fifth Query returns -'c'