Eric has a lot of shoes, way too many shoes.
On the floor, there are shoes, labelled from to . Each of them are either for his left foot or for his right foot, and he wants to pair up each left shoe with a right shoe.
As there is more than one possible answer, you may output any of them. Furthermore, the input is guaranteed to have at least one valid solution.
Constraints
, representing if the shoe is left or right, will always be equal to L
or R
. The amount of L
and R
will always be the same.
Input Specification
The first and only line of input will contain space-separated characters, , where represents the index of the shoe.
Output Specification
You are to output pairs of integers , each on a separate line. Each pair represents a pair of shoes made between shoe and shoe .
The pairs can be printed in any order, and the numbers within each pair can be printed in any order.
Sample Input
L R L R
Sample Output
1 2
3 4
Sample Explanation
We can pair up the first 2 shoes, and the last 2 shoes in order to make pairs. Another valid solution is to pair up the first and last shoe, and then the 2nd and 3rd shoe.
Comments