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