#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, B = 233;
char s[N], str[N];
bitset<N> ch[26];
int main() {
  scanf("%s", str);
  int n = (int)strlen(str);
  for (int i = 0; i < n; ++i) ch[str[i] - 'a'].set(i);
  int q;
  scanf("%d", &q);
  while (q--) {
    int type;
    scanf("%d", &type);
    if (type == 2) {
      int l, r;
      scanf("%d%d%s", &l, &r, s);
      --l, --r;
      int m = (int)strlen(s);
      if (r - l + 1 < m) {
        puts("0");
        continue;
      }
      bitset<N> pos = ch[s[0] - 'a'];
      for (int i = 1; i < m; ++i) pos &= ch[s[i] - 'a'] >> i;
      printf("%d\n", (int)(pos >> l << (N - (r - l + 1 - m + 1))).count());
    } else {
      int x;
      scanf("%d%s", &x, s);
      --x;
      ch[str[x] - 'a'].reset(x);
      str[x] = s[0];
      ch[str[x] - 'a'].set(x);
    }
  }
}
