#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 50;
bitset<maxn> nxt[30], ans;
char s[maxn], str[maxn];
int main() {
  scanf("%s", s + 1);
  int n = strlen(s + 1);
  for (int i = 1; i <= n; i++) nxt[s[i] - 'a'][i] = 1;
  int q;
  scanf("%d", &q);
  while (q--) {
    int op;
    scanf("%d", &op);
    if (op == 1) {
      int x;
      char c;
      scanf("%d %c", &x, &c);
      nxt[s[x] - 'a'][x] = 0;
      nxt[c - 'a'][x] = 1;
      s[x] = c;
    } else {
      int l, r;
      scanf("%d%d%s", &l, &r, str + 1);
      int len = strlen(str + 1);
      if (r - l + 1 < len) {
        puts("0");
        continue;
      }
      ans.set();
      for (int j = 1; j <= len; j++) ans &= (nxt[str[j] - 'a'] >> j);
      printf("%d\n", (int)(ans >> (l - 1)).count() -
                         (int)(ans >> (r - len + 1)).count());
    }
  }
  return 0;
}
