Problem: Given a string s, process q queries, each having one of the following forms:

  * 1 i c — Change the i-th character in the string to c. 
  * 2 l r y — Consider the substring of s starting at position l and ending at position r. Output the number of times y occurs as a substring in it. 

Input

The first line of the input contains the string s (1 ≤ |s| ≤ 105) of lowercase English letters.

The second line contains an integer q (1 ≤ q ≤ 105) — the number of queries to process.

The next q lines describe the queries and may have one of the following forms:

  * 1 i c (1 ≤ i ≤ |s|) 
  * 2 l r y (1 ≤ l ≤ r ≤ |s|) 



c is a lowercase English letter and y is a non-empty string consisting of only lowercase English letters.

The sum of |y| over all queries of second type is at most 105.

It is guaranteed that there is at least one query of second type.

All strings are 1-indexed.

|s| is the length of the string s.

Output

For each query of type 2, output the required answer in a separate line.

Examples

Input

ababababa
3
2 1 7 aba
1 5 c
2 1 7 aba


Output

3
1


Input

abcdcbc
5
2 1 7 bc
1 4 b
2 4 7 bc
1 2 a
2 1 4 aa


Output

2
2
1

Note

Consider the first sample case. Initially, the string aba occurs 3 times in the range [1, 7]. Note that two occurrences may overlap. 

After the update, the string becomes ababcbaba and now aba occurs only once in the range [1, 7].

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int maxr = 10000000;
char rd[maxr], prt[maxr];
int rpos, ppos, mmx;
inline char readc() {
  if (!rpos) mmx = fread(rd, 1, maxr, stdin);
  char c = rd[rpos++];
  if (rpos == maxr) rpos = 0;
  if (rpos > mmx) return 0;
  return c;
}
template <typename T>
inline void read(T &x) {
  x = 0;
  register int flag = 1, c;
  while (((c = readc()) < '0' || c > '9') && c != '-')
    ;
  if (c == '-')
    flag = -1;
  else
    x = c - '0';
  while ((c = readc()) >= '0' && c <= '9') x = x * 10 + c - '0';
  x *= flag;
}
inline int reads(char *s) {
  register int len = 0, c;
  while (isspace(c = readc()) || !c)
    ;
  s[len++] = c;
  while (!isspace(c = readc()) && c) s[len++] = c;
  s[len] = 0;
  return len;
}
inline void printc(char c) {
  prt[ppos++] = c;
  if (ppos == maxr) fwrite(prt, 1, ppos, stdout), ppos = 0;
}
inline void prints(char *s) {
  for (int i = 0; s[i]; i++) printc(s[i]);
}
template <typename T>
inline void print(T x, char c = '\n') {
  if (x < 0) printc('-'), x = -x;
  if (x) {
    static char sta[20];
    register int tp = 0;
    for (; x; x /= 10) sta[tp++] = x % 10 + '0';
    while (tp > 0) printc(sta[--tp]);
  } else
    printc('0');
  printc(c);
}
const int MAXN = 100005, B = 100;
int nxt[MAXN], n, m;
char str[MAXN], ttr[MAXN];
struct SAM {
  int son[205][26], par[205], cnt[205], len[205], buc[205], ord[205], tot, lst;
  void extend(int c) {
    int p = lst, np = ++tot;
    len[np] = len[p] + 1;
    for (; p && !son[p][c]; p = par[p]) son[p][c] = np;
    if (p > 0) {
      int q = son[p][c];
      if (len[q] != len[p] + 1) {
        int nq = ++tot;
        len[nq] = len[p] + 1;
        memcpy(son[nq], son[q], sizeof(son[nq]));
        par[nq] = par[q], par[q] = par[np] = nq;
        for (; son[p][c] == q; p = par[p]) son[p][c] = nq;
      } else
        par[np] = q;
    } else
      par[np] = 1;
    cnt[lst = np] = 1;
  }
  void build(char *s, int n) {
    memset(son, 0, sizeof(son));
    memset(par, 0, sizeof(par));
    memset(cnt, 0, sizeof(cnt));
    memset(len, 0, sizeof(len));
    memset(buc, 0, sizeof(buc));
    tot = lst = 1;
    for (int i = 0; i < n; i++) extend(s[i] - 'a');
    for (int i = 1; i <= tot; i++) ++buc[len[i]];
    for (int i = 1; i <= n; i++) buc[i] += buc[i - 1];
    for (int i = 1; i <= tot; i++) ord[buc[len[i]]--] = i;
    for (int i = tot; i > 1; i--) cnt[par[ord[i]]] += cnt[ord[i]];
  }
  int query(char *s, int n) {
    int k = 1;
    for (int i = 0; i < n && k; i++) k = son[k][s[i] - 'a'];
    return cnt[k];
  }
} sam[1005];
int main() {
  n = reads(str);
  for (int i = 0; i < n; i += B) {
    int j = min(n, i + B);
    sam[i / B].build(str + i, j - i);
  }
  read(m);
  while (m--) {
    int a, b, c;
    read(a), read(b);
    if (a == 1) {
      reads(ttr);
      str[--b] = ttr[0];
      b = b / B * B;
      sam[b / B].build(str + b, min(n, b + B) - b);
    } else {
      read(c);
      --b, --c;
      int l = reads(ttr), res = 0;
      nxt[0] = -1;
      for (int i = 1, j = 0; i < l; i++) {
        while (~j && ttr[j] != ttr[i]) j = nxt[j];
        nxt[i + 1] = ++j;
      }
      if (l > B || c / B - 1 <= b / B) {
        for (int i = b, j = 0; i <= c; i++) {
          while (~j && ttr[j] != str[i]) j = nxt[j];
          if (++j == l) ++res, j = nxt[j];
        }
      } else {
        int lb = b / B, rb = c / B;
        for (int i = b, j = 0; i < (lb + 1) * B + l - 1; i++) {
          while (~j && ttr[j] != str[i]) j = nxt[j];
          if (++j == l) ++res, j = nxt[j];
        }
        for (int i = rb * B - l + 1, j = 0; i <= c; i++) {
          while (~j && ttr[j] != str[i]) j = nxt[j];
          if (++j == l) ++res, j = nxt[j];
        }
        for (int i = lb + 1; i < rb; i++) res += sam[i].query(ttr, l);
        for (int t = lb + 2; t < rb; t++) {
          for (int i = t * B - l + 1, j = 0; i < t * B + l - 1; i++) {
            while (~j && ttr[j] != str[i]) j = nxt[j];
            if (++j == l) ++res, j = nxt[j];
          }
        }
      }
      print(res);
    }
  }
  fwrite(prt, 1, ppos, stdout);
  return 0;
}