At each step he chooses two numbers A and B and then reverses the subsequence between indices A and B(Both are 1-based).
M steps in total;
He wants to know the final text, please help him.
10861086
wavator
3
1 7
3 5
1 5
tavoraw
Note the length of string and the amount of change.