Ants on a Log
A fallen log lies across the forest floor, and n ants are standing on it at n different points.
They are numbered 1 to n from the left end of the log to the right end, so ant i stands
strictly to the left of ant i + 1. Ant i has size s_i and faces either left or right.
At the same moment every ant starts walking in the direction it faces. All ants walk at exactly the same constant speed, and an ant never turns around or stops on its own. The log is long enough that no ant walks off either end while another ant could still reach it.
Two ants walking in the same direction keep the same distance forever, so they never meet. When two ants walking towards each other meet, they fight:
- if one is strictly larger than the other, the smaller ant is eaten, and the larger one keeps walking in its direction at the same speed, with its size unchanged;
- if they have the same size, both are eaten.
An ant can meet ants again and again, as long as it survives. It can be shown that which ants are eaten does not depend on the exact distances between the starting points, only on their order.
Which ants are still alive once no more fights can happen?
Input
The first line contains an integer n (1 ≤ n ≤ 2·10^5), the number of ants.
The second line contains n integers s_1, s_2, …, s_n (1 ≤ s_i ≤ 10^9), the sizes of the ants
from left to right.
The third line contains a string of exactly n characters, each L or R. Its i-th character
is L if ant i walks to the left and R if it walks to the right.
Output
On the first line print k, the number of ants that are never eaten.
On the second line print the numbers of those k ants in increasing order, separated by spaces. If
k = 0, print an empty second line (or nothing).
Notes
In the first example, ant 3 (size 4, walking left) first meets ant 2 (size 2) and eats it, then meets ant 1 (size 5) and is eaten. Ant 4 walks right, away from everyone, and ant 5 meets ant 6: both have size 3, so both are eaten. Ants 1 and 4 survive.
In the second example, every ant walking left is to the left of every ant walking right, so no two ants ever meet.