| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 44 | 14 | 14 | 31.818% |
The cows are playing dictionary games again; there's not much else to do while chewing one's cud. The new game is a simple one but they need to verify their answers.
Given a list of N (1 ≤ N ≤ 100) words, what is the smallest "superword" that contains all of them, in order, as subwords? Consider an example using three words: 'big', 'green', and 'engine'. To make a "superword" (which, regrettably, rarely appears in the dictionary), one combines them carefully to yield: 'bigreengine'.
Words appear sequentially in a superword when the first letter of a constituent word appears strictly later in the superword than the first letter of the previous word and the last letter of that word appears strictly later in the superword than the last letter of the previous word. Here are some two word examples:
Your task is to find superwords.
A single line that contains the "superword".
3 big green engine
bigreengine