시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB68201942.222%

문제

During the whole year Vasya didn't go to the university, therefore he didn't pass his exams and was expelled. That's how he ended up in the army. And the most popular exercise in the army is standing in the order.

There're $n$ soldiers in Vasya's troop including himself. Soldiers are standing in a row, each of them is looking to the left or to the right and have his own serial number from $1$ to $n$ equal to his place in the order. The height of the $i$-th soldier is $h_i$. Vasya thinks that the soldier with number $i$ see the soldier with number $j$ if the following conditions are true:

  • soldier $i$ looks toward the soldier $j$;
  • all soldiers standing between them are not taller than soldier $j$.

For example, if there're $4$ soldiers in the row with heights $h_1 = 178$, $h_2 = 180$, $h_3 = 170$, $h_4 = 190$ and all soldiers are looking to the left, then $2$-nd soldier will see only the $1$-st one, $3$-rd --- only $2$-nd one (because between him and first soldier there is higher second soldier), $4$-th will see $2$-nd and $3$-rd soldier.

Because there is nothing to do in the order, Vasya wants to calculate how many soldiers see each of the soldiers.

입력

The first line of input contains number $n$ --- the number of soldiers in the row ($1 \le n \le 10^5$).

The second line contains $n$ numbers $h_1, h_2, \ldots, h_n$ --- heights of soldiers in the row ($1 \le h_i \le 10^9$).

The third line contains $n$ symbols representing the directions in which the soldiers look: $i$-th symbol is equal <<L>> if $i$-th soldier looks to the left, i.e. potentially can see only the soldiers with serial numbers $1, 2, \ldots, i - 1$, or <<R>> if $i$-th soldier looks to the right and potentially can see only the soldier with serial numbers $i + 1, i + 2, \ldots, n$.

출력

Output $n$ integers, where $i$-th integer is equal to the number of soldiers in the row that $i$-th soldier see.

예제 입력 1

4
178 180 170 190
LLLL

예제 출력 1

0 1 1 2

예제 입력 2

5
178 180 175 170 190
LLRLL

예제 출력 2

0 1 2 2 3

예제 입력 3

5
178 180 170 170 160
LLRLL

예제 출력 3

0 1 1 2 3