Skip to main content
1 of 3

Brainfuck, 27 bytes

,.[->+>+<<]>[-[>>]>[.]<<<-] 

I ran it here

I used mod 2 instead of subtracting 48 to differentiate 0 and 1 which cuts down some characters.