Another ICPC String Problem
You are given a string of length . Process queries of the following types:
Change the -th character of the string (i.e. ) into ;
Answer the query: how many times does occur as a substring of ?
That is, count the number of indices such that and .
Find the result of each query of type 2.
Входные данные
The first line of the input contains integers ().
The second line of the input contains a string of length consisting of lowercase Latin characters.
lines follow, which may have one of the following formats:
If it's a query of the first type, it will contain an integer () and a lowercase character , which means that character becomes
If it's a query of the second type, it will contain a followed by a nonempty string of lowercase characters, meaning that you should find the number of times that occurs as a substring of .
It is guaranteed that there is at least one query of type .
It is guaranteed that the sum of lengths of strings over all queries of the type doesn't exceed .
Выходные данные
For each operation of type output the number of times that the query string appears as a substring of .