Find a set of patterns 1
Easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
For each string from the given set S check, is it true that it contains as a substring at least one string from the set T.
Input
The first line contains the number of strings n (n ≤ 100) in the set T. Each of the next n lines contains the nonempty string of no more than 80 characters.
The last part of the input contains the strings from the set S. Each line consists of ASCII characters with codes from 32 to 126 inclusive. The string can be empty; it is guaranteed that the string length does not exceed 250 characters.
The total input does not exceed 1 МByte.
Output
Print all the strings from set S (in the same order as they are in input), that contains as a substring at least one string from the set T.
Examples
Input #1
Answer #1
Submissions 3K
Acceptance rate 20%