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;
inline int getint() {
  int num = 0, flag = 1;
  char c;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') flag = -1;
  while (c >= '0' && c <= '9') num = num * 10 + c - 48, c = getchar();
  return num * flag;
}
int n, m;
char s[100005], t[100005];
bitset<100005> a[27], ans;
int main() {
  scanf("%s", s);
  n = strlen(s);
  for (int i = 0; i < n; i++) a[s[i] - 97][i + 1] = 1;
  m = getint();
  while (m--) {
    int op = getint();
    if (op == 1) {
      int k = getint() - 1;
      scanf("%s", t);
      a[s[k] - 97][k + 1] = 0, a[t[0] - 97][k + 1] = 1, s[k] = t[0];
    } else {
      int l = getint(), r = getint();
      scanf("%s", t), n = strlen(t);
      ans.set();
      for (int i = 0; i < n; i++) ans &= (a[t[i] - 97] >> i);
      int L = (ans >> l).count(), R = (ans >> (r - n + 2)).count();
      printf("%d\n", max(L - R, 0));
    }
  }
}
