시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 0 0 0 0.000%

문제

Alice and Bob want to go on holiday. Each of them has planned a route, which is a list of cities to be visited in a 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. None wants to change the order of the cities on his or her route or add other cities. Therefore they have no choice but to remove some cities from the route. Of course the common route should be as long as possible.

There are exactly 26 cities in the region. Therefore they are encoded on the lists as lower case letters from ’a’ to ’z’.

입력

The standard input 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 lower case letters with no spaces inbetween.

 

출력

The standard output 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 ones. The order of the routes in the output file doesn’t matter.

예제 입력

abcabcaa
acbacba

예제 출력

ababa
abaca
abcba
acbca
acaba
acaca
acbaa

힌트