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;
bitset<100010> a[26], ans;
int cnt;
vector<int> ori;
void cg() {
  int pos;
  char targ;
  scanf("%d %c", &pos, &targ);
  a[ori[pos - 1]][pos] = 0;
  ori[pos - 1] = targ - 'a';
  a[ori[pos - 1]][pos] = 1;
}
char ta[100010];
void qr() {
  int l, r;
  scanf("%d%d%s", &l, &r, ta);
  int m = strlen(ta);
  if (r - l + 1 < m) {
    printf("0\n");
    return;
  }
  ans.set();
  for (int i = 0; i < m; i++) {
    ans &= (a[ta[i] - 'a'] >> i);
  }
  int res = (ans >> (l)).count() - (ans >> (r - m + 2)).count();
  printf("%d\n", res);
}
int main() {
  int q;
  char tmp;
  while ((tmp = getchar()) != '\n') {
    int ch = tmp - 'a';
    ori.push_back(ch);
    cnt++;
    a[ch][cnt] = 1;
  }
  scanf("%d", &q);
  while (q--) {
    int kind;
    scanf("%d", &kind);
    if (kind == 1)
      cg();
    else
      qr();
  }
  return 0;
}
