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;
char str[100005];
bitset<100005> temp[26], ans;
int main() {
  int n;
  scanf("%s", str);
  scanf("%d", &n);
  for (int i = 0; str[i]; ++i) {
    if (str[i] >= 'a' && str[i] <= 'z') {
      temp[str[i] - 'a'][i + 1] = 1;
    }
  }
  for (int i = 0; i < n; ++i) {
    int op;
    scanf("%d", &op);
    switch (op) {
      case 1:
        int pos;
        char v;
        scanf("%d %c", &pos, &v);
        temp[str[pos - 1] - 'a'][pos] = 0;
        temp[v - 'a'][pos] = 1;
        str[pos - 1] = v;
        break;
      case 2:
        int tl, tr;
        char str2[100005] = {0};
        scanf("%d %d %s", &tl, &tr, str2);
        ans.set();
        int j;
        for (j = 0; str2[j]; ++j) {
          ans &= (temp[str2[j] - 'a'] >> j);
        }
        int left = (ans >> (tl)).count();
        int right = (ans >> (tr - j + 2)).count();
        if (left - right < 0) {
          left = right;
        }
        printf("%d\n", left - right);
        break;
    }
  }
}
