Problem Description
Fayoza says that some letters in the alphabet are more beautiful than others. Also, she claims that some names are more beautiful than others.
You are given a set of beautiful letters. The beauty of a name equals the count of beautiful letters in the name. Among a list of names, find the most beautiful one. If there are ties, print the one that appears first in the list.
Input Format
The first line contains an integer --- the number of names.
The second line contains a string --- the set of beautiful letters. All letters are lowercase English letters.
Each of the next lines contains a string --- the names. All names consist of lowercase English letters.
Constraints:
, where is the set of beautiful letters.
, where is the total length of all names.
Output Format
On a single line, print the most beautiful name. If there are ties, print the one that appears earlier in the list.
Scoring
| Subtask | Constraint | Points |
|---|---|---|
"a" | ||
| No additional constraints |
Notes
In the first sample, the beautiful letters are "a", "f", and "s". The beauties are: "malika" , "fayoza" , "gulrux" , "asila" . Both "fayoza" and "asila" have beauty , but "fayoza" appears first, so the answer is "fayoza".
In the second sample, both "hello" and "world" have beauty .
Examples
4 afs malika fayoza gulrux asila
fayoza
2 a hello world
hello