14357 - 2024_DS_Summer_Assignment2_pD   

Description

Given string of length NS consisting 'L' and 'R'.

Initally, array A contains one zero, that is A = [0].

Please perform the following sequentially for each of S1, S2, S3, ...., Sn:

  • If Si is 'L' : Insert i to the left side of i-1.
  • If Si is 'R' : Insert i to the right side of i-1.

Find the final result of array A.

Input

The first line contains single integer, N.

The second line contains a string S consisting of 'L' and 'R'.

 

Constrain

  • 0 < N ≤ 5 * 105

Output

Print one line, content of array A.

Seperate the elements by space (do not print extra spaces after the last element).

Please add a newline('\n') at the end.

 

Sample Input  Download

Sample Output  Download

Tags




Discuss