Neowise Labs Contest 1 (Codeforces Round 1018, Div. 1 + Div. 2)
A
Wonderful Sticks
Codeforces
800
原题
←B →
翻译中…

You are the proud owner of $n$ sticks. Each stick has an integer length from $1$ to $n$. The lengths of the sticks are distinct.

翻译中…

You want to arrange the sticks in a row. There is a string $s$ of length $n - 1$ that describes the requirements of the arrangement.

翻译中…

Specifically, for each $i$ from $1$ to $n - 1$:

翻译中…
  • If $s_i = \texttt{ \lt }$, then the length of the stick at position $i + 1$ must be smaller than all sticks before it;
  • If $s_i = \texttt{ \gt }$, then the length of the stick at position $i + 1$ must be larger than all sticks before it.
翻译中…

Find any valid arrangement of sticks. We can show that an answer always exists.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 500$). The description of the test cases follows.

翻译中…

The first line of each test case contains a single integer $n$ ($2 \le n \le 100$) — the number of sticks.

翻译中…

The second line of each test case contains a single string $s$ of length $n - 1$ consisting of characters $\texttt{ \lt }$ and $\texttt{ \gt }$ — describing the requirements of the arrangement.

翻译中…

Output

翻译中…

For each test case, output $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \leq a_i \leq n$, the $a_i$ are distinct) — the lengths of the sticks in order. If there are multiple solutions, print any of them.

翻译中…

Note

翻译中…

For the first test case, the requirements of the arrangement are as follows:

翻译中…
  • $s_1 = \texttt{ \lt }$, which means $a_2$ is smaller than $a_1$.
翻译中…

Thus, one possible arrangement is $[2, 1]$.

翻译中…

For the second test case, the requirements of the arrangement are as follows:

翻译中…
  • $s_1 = \texttt{ \lt }$, which means $a_2$ is smaller than $a_1$;
  • $s_2 = \texttt{ \lt }$, which means $a_3$ is smaller than $a_1$ and $a_2$;
  • $s_3 = \texttt{ \gt }$, which means $a_4$ is larger than $a_1$, $a_2$, and $a_3$;
  • $s_4 = \texttt{ \lt }$, which means $a_5$ is smaller than $a_1$, $a_2$, $a_3$, and $a_4$.
翻译中…

Thus, one possible arrangement is $[4, 3, 2, 5, 1]$.

翻译中…

样例

Input #1
5
2
<
5
<<><
2
>
3
<>
7
><>>><
Output #1
2 1
4 3 2 5 1
1 2
2 1 3
3 4 2 5 6 7 1
InputCopy OutputCopy
题目信息
题号
2096A
时间限制
1 s
内存限制
256 MB
标签
构造
贪心

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。