Given a binary integer inclusively between
1111111111111111 (i.e. a 16-bit unsigned integer) as input, output the same integer in negabinary.
The input can be in whatever format is most convenient for your language; for example, if it is easier for the program to handle input with 16 digits, like
0000000000000101, rather than simply
101, you can write the program to only accept input that way.
> 1 1 > 10 110 > 1010 11110 > 110111001111000 11011001110001000 > 1001001 1011001
Here is a sample program I wrote that does base conversions, including negative and non-integer bases. You can use it to check your work.