Logo
(追記) (追記ここまで)

7054번 - Trip 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB39131037.037%

문제

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 in between.

출력

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.

제한

예제 입력 1

abcabcaa
acbacba

예제 출력 1

ababa
abaca
abcba
acbca
acaba
acaca
acbaa

힌트

출처

Olympiad > Central European Olympiad in Informatics > CEOI 2003 > Day 2 6번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /