#include <bits/stdc++.h>
using namespace std;
const int MAX = 100010;
bitset<MAX> b[26];
bitset<MAX> c;
char s[MAX];
int main(void) {
  scanf("%s", s);
  int n = strlen(s);
  for (int i = (0); i < (n); ++i) {
    b[s[i] - 'a'].set(i);
  }
  int m;
  scanf("%d", &m);
  for (int i = (0); i < (m); ++i) {
    int type;
    scanf("%d", &type);
    static char buf[MAX];
    if (type == 1) {
      int idx;
      scanf("%d %s", &idx, buf);
      idx--;
      b[s[idx] - 'a'].reset(idx);
      s[idx] = buf[0];
      b[s[idx] - 'a'].set(idx);
    } else {
      int l, r;
      scanf("%d %d %s", &l, &r, buf);
      --l;
      int m = strlen(buf);
      c.set();
      for (int i = (0); i < (m); ++i) {
        int ch = buf[i] - 'a';
        c &= b[ch] >> (l + i);
      }
      int k = r - l - m + 1;
      c <<= MAX - k;
      int ans = c.count();
      printf("%d\n", ans);
    }
  }
  return 0;
}
