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;
namespace Primary {
const int maxn = 1e5 + 10;
char s[maxn], t[maxn];
int q;
bitset<maxn> help[26], ans;
void main() {
  scanf("%s%d", s, &q);
  int len = strlen(s);
  for (int i = 0; i < len; ++i) help[s[i] - 'a'][i] = 1;
  int opt, ql, qr;
  while (q--) {
    scanf("%d", &opt);
    if (opt == 1) {
      scanf("%d%s", &ql, t), --ql;
      help[t[0] - 'a'][ql] = 1;
      help[s[ql] - 'a'][ql] = 0;
      s[ql] = t[0];
    } else {
      scanf("%d%d%s", &ql, &qr, t);
      len = strlen(t);
      if (len > qr - ql + 1) {
        puts("0");
        continue;
      }
      ans.set();
      for (int i = 0; i < len; ++i) ans &= (help[t[i] - 'a'] >> i);
      int ans_l = (ans >> (ql - 1)).count();
      int ans_r = (ans >> (qr - len + 1)).count();
      printf("%d\n", ans_l - ans_r);
    }
  }
}
}  // namespace Primary
int main() {
  Primary::main();
  return 0;
}
