#MMWX11. String

String

Description

给定一个长为 nn 的字符串 SSQQ 次操作,共两种形式:

  1. 给定 p,cp,c,将 SpS_p 修改为 cc
  2. 给定 l,r,tl,r,t,查询 SlrS_{l\cdots r} 中,字符串 tt 作为子串出现的次数。

Constraints and Subtasks

对于全部测试点,满足:

  • n1×105n \le 1\times 10^5
  • Q2×106Q \le 2\times 10^6
  • t1×105\sum |t| \le 1\times 10^5
  • 所有字符串中的字符均为小写字母,或者说,它们的 ASCII 码在 9797122122 之间。

另外,还有一些测试点满足特殊要求。

分值 特殊性质
20%20\% n1000n\le 1000
80%80\% 无特殊性质

Input

输入内容从标准输入中给出,格式如下:

$ \boxed{\begin{aligned} & S \\ & Q \\ & \text{operator}_1 \\ & \text{operator}_2 \\ & ~ \vdots \\ & \text{operator}_Q \end{aligned}} $

其中,每个 operator\text{operator} 有两种类型:

  1. 1pc\boxed{1 {\quad} p {\quad} c}:表示第一种操作,将 SpS_p 修改为 cc
  2. 2lrt\boxed{2 {\quad} l {\quad} r {\quad} t}:表示第二种操作,查询 SlrS_{l\cdots r} 中,字符串 tt 作为子串出现的次数。

Output

对于每个第二类的操作(即询问),输出一行一个整数表示答案。

Sample

acabababaaabaab
3
2 1 10 aba
1 4 c
2 2 8 aba
3
1