#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 5;
char s[N];
int q;
char y[N], c[3];
bitset<N> state[26], ans;
int main() {
  scanf("%s%d", (s + 1), &q);
  int n = strlen(s + 1);
  for (register int i = 1; i <= n; i++) state[s[i] - 'a'].set(i);
  while (q-- > 0) {
    int op, l, r;
    scanf("%d%d", &op, &l);
    if (op == 1) {
      scanf("%s", c);
      char rw = c[0];
      int x = s[l] - 'a', y = rw - 'a';
      state[x].reset(l);
      state[y].set(l);
      s[l] = rw;
    } else if (op == 2) {
      scanf("%d%s", &r, y);
      ans.set();
      int v = strlen(y);
      r = r - v + 1;
      for (int i = 0; i < v; i++) ans &= (state[y[i] - 'a'] >> i);
      ans <<= (N - r - 1);
      ans >>= (N - r - 1);
      ans >>= l;
      printf("%d\n", ans.count());
    }
  }
  return 0;
}
