Find a set of patterns 2
Easy
Execution time limit is 1 second
Runtime memory usage limit is 445.47 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 (1 ≤ n ≤ 1000) in the set T. Each of the next n lines contains the nonempty string. It is guaranteed that the total sum of all the strings from a set T does not exceed 80000.
The last part of the input contains the satrings from the set S. Each line consists of ACII characters with codes from 32 to 126 inclusive. The string can be empty.
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 set T.
Examples
Input #1
Answer #1
Submissions 1K
Acceptance rate 24%