Mr. Binary Counterman, son of Mr. Boolean Masker & Mrs. Even Oddify, follows in his parents’ footsteps and has a peculiar way of keeping track of the digits.
When given a list of booleans, he counts the 1s and 0s separately, numbering the 1s with the odds & the 0s with the evens.
For example, when he looks at 1 1 0 0 1 0
he counts: 1st odd, 2nd odd, 1st even, 2nd even, 3rd odd, 3rd even
and copies it down as 1 3 2 4 5 6
Mr. Binary Counterman thinks it looks prettier to start counting odds at 1 and evens at 2. However the pattern is more symmetric if you start counting evens at 0. You may do either. So either 1 3 2 4 5 6
or
1 3 0 2 5 4
are good given the list above.
As input you may take any representation of a boolean list or binary number, the output should be the list of resulting numbers with any delimiter. (But the list elements should be separate & identifiable.)
This is code-golf, so least bytes wins.
Test Cases
1 0 1 0 1 0
1 2 3 4 5 6
1 1 1 1
1 3 5 7
0 0 0 0
2 4 6 8
0 1 1 0 0
2 1 3 4 6
0 1 1 0 0 1 0 1 1
2 1 3 4 6 5 8 7 9
0 0 1 0 0 1 1 1
2 4 1 6 8 3 5 7
0
2
1
1
1 1 1 0 0 0
1 3 5 2 4 6