STRGM - EDITORIAL

Difficulty: Easy

Pre-requisites: String manipulation

Problem link:

Contest problem link

Practice problem link

Problem:

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.

Explanation:

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.

str[0]=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