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;
bitset<maxn> b[30], ans;
char s[maxn], tmp[maxn];
int n, m;
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  scanf("%d", &m);
  for (int i = 1; i <= n; ++i) {
    b[s[i] - 'a'].set(i);
  }
  for (int i = 1; i <= m; ++i) {
    int op;
    scanf("%d", &op);
    if (op == 1) {
      int pos;
      scanf("%d%s", &pos, tmp + 1);
      b[s[pos] - 'a'][pos] = 0;
      s[pos] = tmp[1];
      b[s[pos] - 'a'][pos] = 1;
    } else {
      int l, r;
      scanf("%d%d", &l, &r);
      scanf("%s", tmp);
      int len = strlen(tmp);
      ans.set();
      for (int i = 0; i < len; ++i) {
        ans &= (b[tmp[i] - 'a'] >> i);
      }
      len = r - len + 2;
      int left = (ans >> l).count();
      int right = (ans >> len).count();
      if (left < right) left = right;
      printf("%d\n", left - right);
    }
  }
  return 0;
}
