Transformation
Write a program which performs a sequence of commands to a given string str. The command is one of:
print a b: print from the a-th character to the b-th character of str
reverse a b: reverse from the a-th character to the b-th character of str
replace a b p: replace from the a-th character to the b-th character of str with p
Note that the indices of str start with 0.