#include <bits/stdc++.h>
using namespace std;
const double g = 10.0, eps = 1e-12;
const int N = 100000 + 10, maxn = 400000 + 10, inf = 0x3f3f3f3f;
bitset<N> one, s[30], ans;
char ss[N], te[N];
int main() {
  scanf("%s", ss + 1);
  int len = strlen(ss + 1);
  for (int i = 1; i <= len; i++) s[ss[i] - 'a'][i] = one[i] = 1;
  int q;
  scanf("%d", &q);
  while (q--) {
    int op;
    scanf("%d", &op);
    if (op == 1) {
      int id;
      scanf("%d %s", &id, te);
      s[ss[id] - 'a'][id] = 0;
      s[te[0] - 'a'][id] = 1;
      ss[id] = te[0];
    } else {
      int l, r;
      scanf("%d %d %s", &l, &r, te + 1);
      int telen = strlen(te + 1);
      if (r - l + 1 < telen) {
        puts("0");
        continue;
      }
      ans = one;
      for (int i = 1; i <= telen; i++) {
        ans &= (s[te[i] - 'a'] >> (i - 1));
      }
      printf("%d\n", (ans >> (l)).count() - (ans >> (r - telen + 2)).count());
    }
  }
  return 0;
}
