DWITE Online Computer Programming Contest
November 2009
Problem 3
Binary Test String

Besides high school programming contests, another application for automated execution of code is in test suites, that validate the correctness of software (which, in some ways, is what DWITE judge does anyway). Given enough tests and edge cases in sample input, we could increase the confidence that the software is correct. Absolute certainty will require mathematical proofs, or generating every possible sample input and testing against that (which is often not possible).

For this problem, we'll be generating binary strings -- words of length 4, consisting of only 1s and 0s, with certain additional restrictions specified in the input file.

The input file DATA3.txt will contain 5 lines, a binary string of length 1 to 4 -- a pattern that should not appear in binary strings in the generated set.

That is: if the input is "1", then the only valid output string is "0000" (any other binary string of size 4 will contain "1"). Substring "11" disallows: 1100, 0110, 0011; but it also appears in 1110, 0111, and 1111.

The output file OUT3.txt will contain 5 sets of generated binary strings, sorted in ascending order, that is, from 0000 to 1111.

Sample Input (first 2 shown):
Sample Output (first 2 shown):