String Transformer is a unique program designed to take an input string and produce a transformed string as output. This transformation involves applying two types of operations to specific substrings of the input string:
Reversing (denoted as R): this operation reverses the order of the characters in a substring. For example, for the substring S_1 S_2 \ldots S_{n-1} S_n, the result will be S_n S_{n-1} \ldots S_2 S_1.
Sorting (denoted as S): this operation sorts the characters in the substring in non-decreasing (ascending) order according to their alphabetical indices. For example, the substring is transformed into .
You are given a string and a sequence of operations to perform on its substrings. Your task is to determine the final result after applying all these operations.
The first line of the input contains the initial string, which is non-empty and consists only of lowercase Latin letters. The length of this string does not exceed . The second line contains the number of operations , where 1 \leq n \leq 200.
Each of the next lines describes a single operation in the format OP\ L\ R, where is the operation symbol, is the starting position of the substring, and is the ending position (1 \leq L \leq R \leq m). If the string before the operation is S_1 S_2 \ldots S_m, then after the operation it becomes S_1 \ldots S_{L-1}\ OP(S_L \ldots S_R)\ S_{R+1} \ldots S_m, where OP(S_L \ldots S_R) is the result of applying the specified operation to the substring S_L \ldots S_R.
Print the final string after applying all the operations described in the input to the initial string.
Example 1