#T67. 病毒
病毒
Description
One day, Little y suddenly discovered that his computer was infected by a virus! Fortunately, Little y found that this virus was quite weak—it only replaced all the letters in the documents with other letters without changing their order, adding, or deleting any letters. Now, how can he restore the original documents? Little y is very clever. On another uninfected machine, he generated a dictionary consisting of several words, where the words in the dictionary were sorted in alphabetical order. He copied this file to his own machine and deliberately let it get infected by the virus. He intended to use the original ordering of this dictionary file to deduce the virus's letter substitution rules and then use them to restore other documents.
Your task now is: given the virus-infected dictionary, restore a string of letters.
Input Format
The first line contains an integer K (≤50,000), representing the number of words in the dictionary.
The following K lines are the virus-infected dictionary, with one word per line.
The last line is the string of letters you need to restore.
All letters are lowercase.
Output Format
Output only one line, the restored string of letters. However, if the dictionary is incomplete or even incorrect, output a single 0.
6
cebdbac
cac
ecd
dca
aba
bac
cedab
abcde