| 2016 USP Try-outs |
|---|
| Finished |
Donald Trump is a terrible person. It is said he won't sleep at night until he has unfairly offended someone. Donald knows N horrible words and M kind words. For his next speech, he wants to compress the horrible words together to create the most offensive word of all time, while not saying any kind words.
We say a word s contains a word t if it has the word t as a contiguous substring. Trump wants to find the smallest word that contais all N horrible words he knows, and none of the M kind words. Determine one such word.
On the first two integers N and M. In each of the next N lines, a horrible word. In each of the next M lines, a kind word.
Limits
If there is no such word, print only "-" in a single line. Otherwise, print a single string, an answer to the problem. It can only contain lowercase characters from a to j. If there are multiple possible strings, print any of them.
3 0
hejja
gecab
jag
hejjagecab
3 1
ababab
bababb
abbb
babbb
abbbabababb
| Name |
|---|


