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.
wavator 3 1 7 3 5 1 5
Note the length of string and the amount of change.