Coded Messages

Background

You have been assigned the task of building a program to help decode messages. Your program will handle the first step which involves stripping full characters from the message.

It has been determined that the coded strings are constructed of digit and non-digit characters. The digits always occur in matching pairs (ie both are 0s, both are 1s, ...) which together with all characters between them form a digit delimited string (DDS). A DDS may contain other DDSs. A DDS contains no digits other than those delimiting DDSs.

Only those characters contained in a DDS that contains no DDS substring are included in the final message. The digits are not included in the message. The characters of the message appear in the same order that they appear in the input.

For example, consider the string: xy8a7b4c8d7x7e8f4g7h8z. This string contains the DDSs: 7x7, 8d7x7e8, 4c8d7x7e8f4, 7b4c8d7x7e8f4g7, and 8a7b4c8d7x7e8f4g7h8. The single character x is the message from this string. All other characters are discarded since only 7x7 contains no other DDS as a substring.

Properly coded strings do not contain unmatched digits. You may assume that your input is a properly coded string. It has been observed (and you may assume) that the message will be no encoded string will be longer than 20 characters.

Input Specification

The input file DDS.dat will contain a message with at least one properly encoded string.

Output Specification

DDSs from the input file that contain no substring.

Sample Input

Sample 1:
0 There are0no3troops on
35south7west5north57border
and58coast8at sunrise.
Sample 2:
0When in the 78course8 day to day grind
5 of 570playing 1 with3animal and 4human 4 sounds,
we run into8events8 beyond our control31

Sample Output

Sample 1:
 There aretroops on
northcoast
Sample 2:
course of human events

This is from the 1997 Pacise contest.
Note: There was a bug in the input specification for this problem on the original problem statement. I have removed this bug in for our problem Sample 2 was:
0When in the 78course8 day to day grind
5 of 570playing 1 with3animal and 4human 4 sounds,
we run into8events8 beyond our control0