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;
template <typename T>
void read(T& n) {
  char ch;
  int sign = 1;
  while (!isdigit(ch = getchar()))
    if (ch == '-') sign = -1;
  n = ch - '0';
  while (isdigit(ch = getchar())) n = n * 10 + ch - '0';
  n *= sign;
}
const int INF = 1e9 + 7;
const int N = 122222;
int n, m, l, r, first, len, opt;
char s[N], t[N];
bitset<N> occ[35], full;
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = (1); i <= (n); ++i) occ[s[i] - 'a'][i] = 1;
  for (int i = (0); i <= (N - 1); ++i) full[i] = 1;
  read(m);
  while (m--) {
    read(opt);
    if (opt == 1) {
      char ch;
      read(first), scanf("%c", &ch);
      occ[s[first] - 'a'][first] = 0, occ[ch - 'a'][first] = 1;
      s[first] = ch;
    } else {
      read(l), read(r), scanf("%s", t + 1);
      len = strlen(t + 1);
      if (r - l + 1 < len) {
        puts("0");
        continue;
      }
      bitset<N> cnt = full, ans = (1 << (r - len + 1)) - 1;
      for (int i = (1); i <= (len); ++i) cnt &= occ[t[i] - 'a'] >> i;
      ans = (ans & cnt) >> (l - 1);
      printf("%d\n", (int)ans.count());
    }
  }
  return 0;
}
