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

33602번 - Mascot Naming 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 2048 MB37222158.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:

  • The name must include specific words as subsequences* , such as the event name and location. You are given the list $s_1, s_2, \dots , s_n$ of the $n$ required words.
  • The name must not contain as a subsequence* the name t of last year’s mascot.

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.

제한

예제 입력 1

2
porto
euc
prague

예제 출력 1

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.

예제 입력 2

6
credit
debit
money
rich
bank
capitalism
trap

예제 출력 2

YES
moncrdebditeychankpitalism

예제 입력 3

2
axiom
choice
io

예제 출력 3

NO

예제 입력 4

4
aaa
aab
abb
bbb
ba

예제 출력 4

YES
aaabbb

힌트

출처

ICPC > Regionals > Europe > European Championship > The 2025 ICPC European Championship F번

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

출처

대학교 대회

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

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