#P3808. Distinct Pattern Occurrences

    ID: 17058 Type: Default 1000ms 256MiB

Distinct Pattern Occurrences

Distinct Pattern Occurrences

Given ( n ) patterns ( s_i ) and a text string ( t ), count the number of distinct patterns that appear in ( t ). Note that even if two patterns have the same content, they are considered distinct if their indices are different.

inputFormat

The input is given in the following format:

( n )
( s_1 )
( s_2 )
( \vdots )
( s_n )
( t )

The first line contains an integer ( n ). Each of the next ( n ) lines contains a pattern string ( s_i ). The last line contains the text string ( t ).

outputFormat

Output a single integer representing the number of patterns that occur in the text string ( t ).

sample

3
abc
bc
abc
abcde
3

</p>