The solution to a codeforces' algorithmic task (a hashing algorithm)
We have three different operations:
- Add a string to the set
- Remove a string from the set
- Make a query about the number of occurences of the strings from the set in given string
Input
5
1 aaa
1 abc
3 aaaabc
2 aaa
3 aaaabc
Output
3
1