## CJam, <s>10</s> 8 bytes l2/{)-}% [Test it here.][1] ### Explanation This is a very simple solution: in each pair, remove all instances of the last character. Repeated digits and unpaired trailing digits will be removed, as will be the second digit in any pair of unequal digits: "0" --> "" "1" --> "" "00" --> "" "01" --> "0" "10" --> "1" "11" --> "" This leaves only the digits we're looking for. Here's how the code computes this: l e# Read input. 2/ e# Split into pairs. Odd inputs will yield a single-character string at the end. { e# Map this block over the pairs... ) e# Pull the last character off the string. - e# Remove all occurrences of that character from the remainder (which is either e# an empty string to begin with or a single-digit string). }% When the list is auto-printed at the end of the program, the empty strings are simply omitted. [1]: http://cjam.aditsu.net/#code=l2%2F%7B)-%7D%25&input=1011101010