Due to the poor quality of the data, the ornithologists believe that the computer often mistakes one type of bird with another, but believe they can correct for this by ignoring data inconsistent with known grouping patters of birds.
A `string' of birds is a group of at least three birds, each separated by no more than two other birds. `AooAooAoeeAoe' would be a string of seven `A' birds and a string of six `e' birds, and `aBBaBcBBaaBaBacCd' would be a string of twelve `B' birds. The ornithologists appear unconcerned with the longest string of birds it is possible to produce, preferring to deal with the data on a first come, first served basis.
The output must be in a specific order, so that the pecking order of the different bird species is made clear. Each species prefers a particular position on the wires, the most important bird near the center of that preference, and the less important birds surrounding it. In order to preserve this information, the following format is desired.
First, a printed numberline, in the format shown in the sample below. Under this line, print the string of birds with the lowest starting number. Other strings should follow on the same line, if it is possible to print them without overlap. Strings that would overlap should be printed on the next line, again following the rule of lowest start gets printed first. If the start of two strings is the same, the string with the lowest ending gets printed first. If the start of two strings is the same, the string with the lowest ending gets printed first. There will be no strings with the same start and end numbers.
abcbcbdsabadfsaassddswsrwads eereweejeeweejkjejjkwjkejek andenadenadqenaembps azsxdcfvazsxdcfvazsxdcfvazsxdcfvazsxdcfvazsxdcfvaasdadsaweadaweaas lkljbvkklsfaswiijsjwajasdkh
0123456789 1234567890123456789 1234567890123456789 1234567890123456789 eeeeeeeeeeeeessssssssss aaaaaaaaaaaaaaaaa bbbbb jjjjjjjjjjjj jjjjjj