#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
char s[N], t[N];
int n, m, q, op, x, y;
bitset<N> ans, pos[26];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; i++) pos[s[i] - 'a'].set(i);
  scanf("%d", &q);
  while (q--) {
    scanf("%d", &op);
    if (op == 1) {
      scanf("%d%s", &x, t + 1);
      pos[s[x] - 'a'].reset(x);
      s[x] = t[1];
      pos[s[x] - 'a'].set(x);
    } else {
      scanf("%d%d%s", &x, &y, t + 1);
      m = strlen(t + 1);
      ans.set();
      for (int i = 1; i <= m; i++) ans &= pos[t[i] - 'a'] >> (i - 1);
      int w = (ans >> x).count() - (ans >> (y - m + 2)).count();
      printf("%d\n", max(w, 0));
    }
  }
  return 0;
}
