Flip Sorting
Chef has a binary string
of length . Chef can perform the following operation onany number of times (possibly zero):
- Choose a number
- ).
Chef wants to sort
in non-decreasing order using any sequence of operations. Can you help Chef find such a sequence of operations?
If there are multiple answers, print any.
Input Format
- The first line contains a single integer
- s only.
Output Format
For each test case,
- Output in the first line
- selected should not be used in any of the previous operations)
Constraints
Sample Input 1
3
6
110111
9
110110111
5
00111
Sample Output 1
1
1 2
2
1 2
4 3
0
Explanation
Test Case 1: The operations applied are as follows:
.
Test Case 2: The operations applied are as follows:
.
Comments
Post a Comment