#P1936B. Pinball

    ID: 10389 Type: RemoteJudge 2000ms 256MiB Tried: 0 Accepted: 0 Difficulty: 7 Uploaded By: Tags>binary searchdata structuresimplementationmathtwo pointers*2000

Pinball

Description

There is a one-dimensional grid of length nn. The ii-th cell of the grid contains a character sis_i, which is either '<' or '>'.

When a pinball is placed on one of the cells, it moves according to the following rules:

  • If the pinball is on the ii-th cell and sis_i is '<', the pinball moves one cell to the left in the next second. If sis_i is '>', it moves one cell to the right.
  • After the pinball has moved, the character sis_i is inverted (i. e. if sis_i used to be '<', it becomes '>', and vice versa).
  • The pinball stops moving when it leaves the grid: either from the left border or from the right one.

You need to answer nn independent queries. In the ii-th query, a pinball will be placed on the ii-th cell. Note that we always place a pinball on the initial grid.

For each query, calculate how many seconds it takes the pinball to leave the grid. It can be shown that the pinball will always leave the grid within a finite number of steps.

Each test contains multiple test cases. The first line contains the number of test cases tt (1t1051 \le t \le 10^5). The description of the test cases follows.

The first line of each test case contains an integer nn (1n51051 \le n \le 5 \cdot 10^5).

The second line of each test case contains a string s1s2sns_1s_2 \ldots s_{n} of length nn consisting of characters '<' and '>'.

It is guaranteed that the sum of nn over all test cases does not exceed 51055 \cdot 10^5.

For each test case, for each ii (1in1 \le i \le n) output the answer if a pinball is initially placed on the ii-th cell.

Input

Each test contains multiple test cases. The first line contains the number of test cases tt (1t1051 \le t \le 10^5). The description of the test cases follows.

The first line of each test case contains an integer nn (1n51051 \le n \le 5 \cdot 10^5).

The second line of each test case contains a string s1s2sns_1s_2 \ldots s_{n} of length nn consisting of characters '<' and '>'.

It is guaranteed that the sum of nn over all test cases does not exceed 51055 \cdot 10^5.

Output

For each test case, for each ii (1in1 \le i \le n) output the answer if a pinball is initially placed on the ii-th cell.

Sample Input 1

3
3
&gt;&lt;&lt;
4
&lt;&lt;&lt;&lt;
6
&lt;&gt;&lt;&lt;&lt;&gt;

Sample Output 1

3 6 5 
1 2 3 4 
1 4 7 10 8 1

Note

In the first test case, the movement of the pinball for i=1i=1 is shown in the following pictures. It takes the pinball 33 seconds to leave the grid.

The movement of the pinball for i=2i=2 is shown in the following pictures. It takes the pinball 66 seconds to leave the grid.