abcdabcdab
5
2 2 8 ab
2 1 10 ab
1 3 a
1 4 b
2 1 4 ab

1
3
2

#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n;
char y[maxn];
void kmp_pre(int next[], char x[], int m) {
  int i, j;
  j = next[0] = -1;
  i = 0;
  while (i < m) {
    while (j != -1 && x[i] != x[j]) j = next[j];
    next[++i] = ++j;
  }
}
int kmp_cnt(int next[], char x[], int m, int l, int r) {
  int ans = 0;
  kmp_pre(next, x, m);
  int i = l, j = 0;
  while (i <= r) {
    while (j != -1 && y[i] != x[j]) j = next[j];
    ++i;
    ++j;
    if (j >= m) {
      ans++;
      j = next[j];
    }
  }
  return ans;
}
int main() {
  int T;
  int next[maxn];
  char x[maxn];
  scanf("%s%d", y + 1, &n);
  while (T--) {
    int cmd;
    scanf("%d", &cmd);
    if (cmd == 1) {
      int pos;
      char ch;
      cin >> pos >> ch;
      y[pos] = ch;
    } else {
      int l, r;
      scanf("%d%d%s", &l, &r, x);
      printf("%d\n", kmp_cnt(next, x, strlen(x), l, r));
    }
  }
  return 0;
}
