恢复

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Background

One day, Euler suddenly discovered that his mobile phone was infected with a virus! On the Internet, I found it was the legendary CXK virus! Fortunately, Euler's Gauss mobile phone defense system is very good, which makes CXK virus only replace all the letters in Euler's Baidu network disk document with other letters, but it does not change the order, nor will it add or delete letters. How to restore the original document now! Euler is very smart. He bought dozens of Gauss mobile phones and found Uncle lv. Uncle lv generated a dictionary composed of several words on other mobile phones that were not infected with CXK virus. The words in the dictionary are arranged in alphabetical order. He copied this to Euler's mobile phone, intentionally infected it with Gauss virus, and tried to destroy Euler's mobile phone. He wanted to use the original order of the dictionary file to find the rule of replacing letters by Gauss virus, and then used it to restore other documents. Since this task is relatively easy (ji ā n á n), I will give it to you.

有一天,欧拉突然发现自己的手机感染了一种病毒!上网一查,发现居然是传说中的CXK病毒!幸好,欧拉的高斯牌手机防御系统很好,才使CXK病毒只把欧拉百度网盘文档中的所有字母替换成其它字母,但并不改变顺序,也不会增加和删除字母。
现在怎么恢复原来的文档呢!欧拉很聪明,他又买来了几十部高斯牌手机,找来了lv叔叔,lv叔叔在其他没有感染CXK病毒的手机上,生成了一个由若干单词构成的字典,字典中的单词是按照字母顺序排列的,他把这个拷贝到欧拉的手机里,故意让它感染上高斯病毒,企图破坏欧拉的手机,他想利用这个字典文件原来的有序性,找到高斯病毒替换字母的规律,再用来恢复其它文档。由于这项任务较为轻松(jiān nán),所以把任务交给你。

Description

Now your task is to tell you the dictionary infected by CXK virus and ask you to restore a string.

现在你的任务是:告诉你被CXK病毒感染了的字典,要你恢复一个字符串。

Input

The first line is integer K(≤50000), which indicates the number of words in the dictionary.
The following K lines are dictionaries infected by viruses, one word per line.
The last line is a string of letters that need your recovery. All letters are lowercase.

第一行为整数K(≤50000),表示字典中的单词个数。
以下K行,是被病毒感染了的字典,每行一个单词。
最后一行是需要你恢复的一串字母。所有字母均为小写。

Output

The output is only one line, which is a string of letters after recovery. Of course, it is also possible that the dictionary is incomplete or even wrong. Please output a 0.

输出仅一行,为恢复后的一串字母。当然也有可能出现字典不完整、甚至字典是错的情况,这时请输出一个0。

Input

6
cebdbac
cac
ecd
dca
aba
bac
cedab

Output

abcde

Limitation

K<=50000

Source

Amorphophallus Orz Group

AOG月赛测试题1「2月月赛」

未参加
状态
已结束
规则
OI
题目
4
开始于
2020-02-28 00:00
结束于
2020-03-01 20:00
持续时间
68.0 小时
主持人
参赛人数
16