#P2013. ACSL 2016-2017 Junior Division Contest #2 ACSL ASCENDING

ACSL 2016-2017 Junior Division Contest #2 ACSL ASCENDING

This program requires you to take a string of digits and form a sequence of numbers from that string, such that each number is larger than the previous number in the sequence, and the digits of the numbers in the sequence are in the same order as in the initial string. The first number of the sequence is the first digit of the input string, and digits at the end of the input string that cannot be formed into a number larger than the previous number in the sequence should simply be ignored.

For example, the string 314159265 would form the sequence of numbers 3, 14, 15, and 92, as follows: The first number in the sequence is the first digit in the input string, the number 3. The next digit is a 1, but since that is not greater than 3 (the previous number in the output sequence), we go further and combine it with the 4 to make the number 14, which is larger than 3. Similarly, the next two digits form the number 15; the two digits after that form 92. The remaining 6 and 5 are not used since 65 is not larger than 92.

INPUT FORMAT

There will be 5 lines of input. Each line will contain a string of digits. Its length will be at least 1 and no more than 20.

OUTPUT FORMAT

The sequence of numbers formed as described above; each number in the sequence must be separated by a single space.

SAMPLE

INPUT

314159265
11223344
25897257
91
9876543210

OUTPUT

3 14 15 92
1 12 23 34
2 5 8 9 72
9
9 87 654 3210