Input: Either one or two strings of '0's and '1's. If there are 2, they are separated by a space. All strings are of length at least 1.
Output: If one string was input, 2 are output. If 2 were input, 1 is output. The output strings can be whatever you like, but if running your program with input A gives you B, then running it with B must give A (if inputting
111 11 gives
00000, then inputting
00000 must give
That means if you pipe your program to itself, you should get back whatever you input. If your program is called foo, you can test that like this:
>echo 101 101|foo|foo 101 101
To prevent the use of brute force techniques, your code should be able to run with 1000 digit strings in under 10 seconds. My python solution for this takes less than 1 second on 10,000 digit strings so this shouldn't be a problem.
Shortest code wins.