| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 (추가 시간 없음) | 2048 MB | 37 | 22 | 21 | 58.333% |
When organizing a big event, organizers often handle side tasks outside their expertise. For example, the chief judge of EUC 2025 must find a name for the event’s official mascot while satisfying certain constraints:
Please help the chief judge find a valid mascot name or determine that none exists.
*A string $x$ is a subsequence of a string $y$ if $x$ can be obtained from $y$ by erasing some characters (at any positions) while keeping the remaining characters in the same order. For example, abc is a subsequence of axbycz but not of acbxyz.
The first line contains an integer $n$ (1ドル ≤ n ≤ 200,円 000$) — the number of words that shall appear as subsequences.
The $i$-th of the following $n$ lines contains the string $s_i$ (1ドル ≤ |s_i | ≤ 200,円 000,ドル $s_i$ consists of lowercase English letters) — the $i$-th word in the list of words that shall appear as subsequences. The total length of these $n$ words is at most 200ドル,円 000,ドル i.e., $|s_1| + |s_2| + \cdots + |s_n| ≤ 200,円 000$.
The last line contains the string $t$ (1ドル ≤ |t| ≤ 200,円 000,ドル $t$ consists of lowercase English letters) — the name of last year’s mascot.
Print YES if there is a valid name for the mascot. Otherwise, print NO.
If there is a valid name, on the next line print a valid name. The string you print must have length at most 1ドル,円 000,円 000$ and must consist of lowercase English letters. One can prove that if a valid name for the mascot exists, then there is one satisfying these additional constraints.
If there are multiple solutions, print any of them.
2 porto euc prague
YES poretuco
The words that must appear as subsequences are porto and euc, while the word that must not appear as a subsequence is prague. There are many valid names for the mascot, e.g., poretuco or xxxpppeortoucyyyy.
If poretuco is chosen as the name of the mascot, observe that porto and euc are subsequences (highlighted in POReTucO and porEtUCo, respectively), while prague is not, as desired.
The string poretuc is not a valid mascot name because it does not contain the word porto as a subsequence. Also the string poretucoague is not a valid mascot name because it contains prague as a subsequence.
6 credit debit money rich bank capitalism trap
YES moncrdebditeychankpitalism
2 axiom choice io
NO
4 aaa aab abb bbb ba
YES aaabbb