13434 - The password - HARD   

Description

Mr. Kuo is an adventurer. One day, he finds a secret room in a cave.

There is some hint to the password of this room.

 

Mr. Kuo is given an integer N and a string S = s1s2...sN consisting of LR, F, and B.

At first, Mr. Kuo has a string A = "0".

For each i = 1, 2, ..., N :

  • If si is L, insert i to the left the "number" of i - 1 in A.
  • If si is R, insert i to the right the "number" of i - 1 in A.
  • If si is F, insert i to the front of A.
  • If si is B, insert i to the back of A.

 

The final contents of A is the password. Please help Mr. Kuo find the password.

 

For example, N = 6 and S = "LRFRLB", then:

  • s1 = L, insert 1 to the left of 0, A = "10".
  • s2 = R, insert 2 to the right of 1, A = "120".
  • s3 = F, insert 3 to the front, A = "3120".
  • s4 = R, insert 4 to the right of 3, A = "34120".
  • s5 = L, insert 5 to the left of 4, A = "354120".
  • s6 = B, insert 6 to the back of A, A = "3541206".

 

Input

The first line contains one integer T — the number of test cases. Description of the test cases follows.

The first line of each test cases contains an integer N.

The second line of each test cases contains a string S consisting of LRF, and B of length N.

 

For each test:

  1. T ≤ 100, N ≤ 100, S consists of L and R.
  2. T ≤ 100, N ≤ 1000, S consists of L and R.
  3. T ≤ 100, N ≤ 10000, S consists of L and R.
  4. T ≤ 100, N ≤ 1000, S consists of LR, F, and B.
  5. T ≤ 100, N ≤ 10000, S consists of LRF, and B.
  6. T ≤ 10, N ≤ 100000, S consists of LRF, and B.

 

Output

For each test case print a string A — the final contents of the password, seperated by spaces.

 

Sample Input  Download

Sample Output  Download

Tags




Discuss