12631263 SUSTech Online Judge
Problem 1263 --Coverted Vinux input

1263: Coverted Vinux input

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 1011  Solved: 173
[Submit][Status][Web Board]

Description

Narnal is a huge fan of vim, so he has created a text editor called Vinux, which can only edit one line with several operations. Each line has an invisible undeletable tail character called EOL (end of line), which will always stay at the end of the line in any circumstance. Notice that the undeletable property of EOL means that EOL will revive immediately at the end of the line whenever it vanishes (been replaced or deleted). He wants to covert a one-line keyboard input containing operations and digits into a one-line real input with only digits.

Only the following operations are available:

r: next single input would replace the current character;

I: move the character pointer to the head of the line;

H: left shift the current character pointer unless it is at the leftmost place;

L: right shift the current character pointer unless it is at the rightmost place;

x: delete the current character;

Otherwise, each input would insert before the current character.

Input

First line will be a positive integer \(T\), which is the number of test cases.

In each test case, the first line would be an integer \(n\) for the length of the keyboard input of Vinux. Then the following line represents the keyboard input of Vinux.

\(T \leq 20, 20 \leq n \leq 10^{5}\). The aiming real input only contains digits without blanks. The input would always be valid (the input after r would never be an operation character).

Output

For each case, output one line shows the real input without EOL.

Sample Input

2
25
12345HHHr9Ir000LLLLL876Ix
20
r60xxxxHx4xHH3III1I2

Sample Output

002945876
2134

HINT

Sample 1
 real:
index:
input:

Sample 2
 real:
index:
input:

Source

[Submit][Status]