#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int M = 405, C = N / M + 5;
char s[N];
int n, q, op, x, y;
char t[N];
int len;
bitset<N> a[26], b, c;
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1, _b = n; i <= _b; i++) a[s[i] - 'a'][i] = 1;
  scanf("%d", &q);
  for (int i = 1, _b = n; i <= _b; i++) b[i - 1] = 1;
  for (int ii = 1, _b = q; ii <= _b; ii++) {
    scanf("%d", &op);
    if (op == 1) {
      scanf("%d", &x);
      scanf("%s", t + 1);
      len = strlen(t + 1);
      a[s[x] - 'a'][x] = 0;
      s[x] = t[1];
      a[s[x] - 'a'][x] = 1;
    } else {
      scanf("%d %d", &x, &y);
      scanf("%s", t + 1);
      len = strlen(t + 1);
      c = b;
      for (int i = 1, _b = len; i <= _b; i++) {
        c &= a[t[i] - 'a'] >> i;
      }
      y -= len - 1;
      if (y < x) {
        printf("0\n");
      } else {
        printf("%d\n", (c >> (x - 1)).count() - (c >> (y)).count());
      }
    }
  }
}
