CEOI 2003 - Contest Environment | |||||||||||||||
Menu MainTasks: pearls register trip Logout |
Task descriptionPrint view - submit programTrip
Alice and Bob want to go on a holiday. Each of them has planned a route, which is a list of cities to visit in the given order. A route may contain a city more than once. As they want to travel together, they have to agree on a common route. Neither wants to change the order of the cities on his or her route or add new cities. Therefore they have no choice but to remove some cities from their routes. Of course the common route should be as long as possible. There are exactly 26 cities in the region. Therefore they are encoded in the lists as lowercase letters from 'a' to 'z'. InputThe input file trip.in consists of two lines; the first line is Alice's list, the second line is Bob's list. Each list consists of 1 to 80 lowercase letters with no spaces in between. OutputThe output file trip.out should contain all routes that meet the conditions described above, but no route should be listed more than once. Each route should be printed on a separate line. There is at least one such non-empty route, but never more than 1000 different routes. The order of the routes in the output file doesn't matter. Example
TranslationsCroatianCzech Dutch German Polish Slovakian |