#K46657. Sock Position Identifier
Sock Position Identifier
Sock Position Identifier
You are given a string representing the arrangement of socks. Each character in the string is either 'L' or 'R', which refer to a left sock or a right sock respectively. Your task is to determine the positions of all left socks and all right socks in the string.
Note that the positions are 1-indexed. If there are no socks of a specific type, output an empty line for that category.
For example, given the input RLRLLR
, the left socks are at positions \(2, 4, 5\) and the right socks are at positions \(1, 3, 6\).
inputFormat
The input is provided from standard input (stdin) and consists of a single line containing a non-empty string of characters. Each character is either 'L' or 'R'.
Example:
RLRLLR
outputFormat
Print two lines to standard output (stdout):
- The first line should contain the positions of all left socks, separated by a space.
- The second line should contain the positions of all right socks, separated by a space.
If there are no positions to print for a category, output an empty line for that category.
Example output for the input RLRLLR
:
2 4 5 1 3 6## sample
RLRLLR
2 4 5
1 3 6
</p>