As you know, string has several operations:
1. Add x pos: add char x to the
2. Delete pos: delete char at the
3. Sstr x y: print the substring
of s from position x to y (don’t change origin string s).
4. Reverse x y: reverse the char
from position x to y
Now give you a string S and n operations,
please output the result after each operation.
The string begins with index 0.
The first line will be an integer T, which
is the number of test cases. (1 <= T <= 10)
The second line is a string S. |S| <=
1000. S will contain both upper case and lowercase English letters.
The third line will be an integer n (1
<= n <= 40). Then n operations:
Add x pos
Sstr x y
Reverse x y
Where x, y and pos are integers. The input
ensures all operations are legal, and x <= y.
strings for each test case, the result after each operations.