Purify

No attempts yetTime limit1sMemory limit64 MB

Problem

Your task is to tidy up all the clutter (a list of forbidden words NiN_i) scattered around your room (a text string PP).

Write a program that removes every occurrence of the strings NiN_i from the string PP. More precisely, while PP contains some NiN_i as a substring, repeat the following: take the shortest prefix of PP that contains some NiN_i, and delete from it the shortest string NiN_i that this prefix contains.

Input

The first line contains a string PP consisting of digits and lowercase and uppercase English letters. The length of PP is at most 10510^5. Each of the following lines contains exactly one string NiN_i, also consisting of digits and lowercase and uppercase English letters. The total length of all strings NiN_i is at most 10510^5.

Output

Print, on a single line, what remains of PP after all NiN_i have been removed. You may assume that the remaining length of PP is always at least 1.