#aising2020d. [aising2020_d]Anything Goes to Zero
[aising2020_d]Anything Goes to Zero
Problem Statement
Let be the number of 1
s in the binary representation of . For example, , , and .
Let be the number of times the following operation will be done when we repeat it until becomes : "replace with the remainder when is divided by ." (It can be proved that, under the constraints of this problem, always becomes after a finite number of operations.)
For example, when , it becomes after two operations, as follows:
- , so we divide by and replace it with the remainder, .
- , so we divide by and replace it with the remainder, .
You are given an integer with digits in binary. For each integer such that , let be what becomes when the -th bit from the top is inverted. Find .
Constraints
- is an integer with digits in binary, possibly with leading zeros.
Input
Input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the value .
Sample Input 1
3
011
Sample Output 1
2
1
1
- , which will change as follows: . Thus, .
- , which will change as follows: . Thus, .
- , which will change as follows: . Thus, .
Sample Input 2
23
00110111001011011001110
Sample Output 2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
3