Dictionary Match Count
Given a dictionary of P patterns and a text T, print the total number of pattern occurrences in T (each pattern counted every time it appears; duplicate patterns count each copy).
Input: the first line has P; the next P lines are the patterns; the following line is the text T.
Output: the total occurrence count.
Constraints:
- 1 ≤ P ≤ 104
- total pattern length ≤ 105
- 1 ≤ |T| ≤ 105
Sample Tests
Input 1
2 ab bc abcbc
Output 1
3
Input 2
1 xy abc
Output 2
0
Discussion (opens after you solve — no spoilers before)
No comments yet.