Pre-requisites: String manipulation
Given a string and a list of queries, apply the queries sequentially on the string.
The operation of the queries have been mentioned in the problem statement @ link.
Following are the queries that are to be eecuted on the given string, str.
S x: substitute the character at the first character with x.
D y: Delete all occurrences of character y from the string.
Search for the character y in the string and delete them.
R n: Arrange the first n characters in reverse order and leave the rest of the characters as it is.
Reverse the string till position n.
Problem setter’s solution: SOLUTION