Another ICPC String Problem#10825

Another ICPC String Problem

2 seconds
512 megabytes
Very hard

You are given a string of length . Process queries of the following types:

  1. Change the -th character of the string (i.e. s_i) into ;

  2. Answer the query: how many times does occur as a substring of ?

    That is, count the number of indices such that 1 \leq i \leq n - m + 1 and s_{i} s_{i + 1} \dots, s_{i + m - 1} = p_1 p_2 \dots p_m.

Find the result of each query of type 2.

Input

The first line of the input contains integers (1 \leq n \leq 5\times 10^4, 1 \leq q \leq 10^5).

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:

  1. If it's a query of the first type, it will contain an integer k_i (1 \leq k_i \leq n) and a lowercase character c_i, which means that character s_{k_i} becomes c_i

  2. 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 5\cdot 10^4.

Output

For each operation of type output the number of times that the query string appears as a substring of .

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading