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 q;
int a[maxN + 1];
char s[maxN + 1];
bitset<maxN> b[26], res;
int main() {
  scanf("%s", s + 1);
  int len = strlen(s + 1);
  for (int i = 1; i <= len; i++) b[a[i] = s[i] - 'a'].flip(i);
  scanf("%d", &q);
  while (q--) {
    int op, x, y;
    scanf("%d", &op);
    if (op == 1) {
      scanf("%d %s", &x, s + 1);
      int c = s[1] - 'a';
      b[a[x]].flip(x);
      b[a[x] = c].flip(x);
    } else {
      scanf("%d %d %s", &x, &y, s + 1);
      len = strlen(s + 1);
      res.set();
      for (int i = len; i >= 1; i--) {
        res = res & b[s[i] - 'a'];
        if (i > 1) res >>= 1;
      }
      printf("%d\n",
             (int)(res >> x).count() - (int)(res >> (y - len + 2)).count());
    }
  }
  return 0;
}
