Substring Query
题号:NC52820
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 32 M,其他语言64 M
Special Judge, 64bit IO Format: %lld

题目描述

Given a string of length n,
Bobo is going to perform q operations of the following 2 kinds:

1. to change the i-th character of the string (i.e. s_i) into c;
2. to query how many times does p occur as substring of s.
That is, count the number of indices i such that and .

Find out the result of each opeartion of the second kind.

输入描述:

The input contains at most 10 sets. For each set:

The first line contains 2 integers n, q
().

The second line contains a string of lowercase characters.

The i-th of the last q lines may:
1. contains an integer k_i and a lowercase character c_i,
which denote an operation to change the into c_i
().
2. contains an 0 followed by a string of lowercase characters,
which denote an operation to query the number of times that occurs as a substring ().

输出描述:

For each operation of second kind in each set,
an integer denotes the number of substrings.
示例1

输入

复制
5 5
aaaaa
0 aa
2 b
0 aba
4 b
0 aba

输出

复制
4
1
2
示例2

输入

复制
1 1
a
0 a

输出

复制
1