Mascot Naming
시간 제한2초메모리 제한2048 MB
모든 s_i를 부분열로 포함하면서 t는 부분열로 포함하지 않는 문자열이 존재하는지 판정하고, 존재하면 하나를 출력한다.
문제
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 of the 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 is a subsequence of a string if can be obtained from 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 () — the number of words that shall appear as subsequences.
The -th of the following lines contains the string (, consists of lowercase English letters) — the -th word in the list of words that shall appear as subsequences. The total length of these words is at most , i.e., .
The last line contains the string (, 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 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.