abcdabcdab
5
2 2 8 ab
2 1 10 ab
1 3 a
1 4 b
2 1 4 ab

1
3
2

#include <bits/stdc++.h>
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
const int maxn = 1e5 + 10;
char a[maxn];
char p[maxn];
int jump[maxn];
void do_kmp(int n) {
  jump[0] = -1;
  int j = 0;
  for (int i = 1; i < n; i++) {
    if (p[i] == p[j]) {
      jump[i] = j++;
    } else {
      while (j >= 0 && p[i] != p[j]) {
        j = jump[j];
      }
      jump[i] = j++;
    }
  }
}
int match_kmp(int l, int r, int n) {
  if (r <= l) return 0;
  int counter = 0;
  int j = -1;
  for (int i = l; i < r; i++) {
    while (j != -1 && a[i] != p[j + 1]) {
      j = jump[j];
    }
    if (a[i] == p[j + 1]) {
      ++j;
    }
    if (j == n - 1) {
      counter++;
      j = jump[j];
    }
  }
  return counter;
}
const int K = 320;
struct sa_t {
  static const int maxs = 314;
  struct state_t {
    std::map<char, int> next;
    int link, len;
    char end;
  };
  state_t st[maxs * 2];
  int size[maxs * 2];
  int deg[maxs * 2];
  int last = 0, sz = 1;
  void append(char ch) {
    int c = sz++;
    int p = last;
    st[c].end = 1;
    st[c].len = st[last].len + 1;
    while (p > -1 && st[p].next.count(ch) == 0) {
      st[p].next[ch] = c;
      p = st[p].link;
    }
    if (p == -1) {
      st[c].link = 0;
    } else {
      int q = st[p].next[ch];
      if (st[q].len == st[p].len + 1) {
        st[c].link = q;
      } else {
        int clone = sz++;
        st[clone] = st[q];
        st[clone].len = st[p].len + 1;
        st[clone].end = 0;
        while (p > -1 && st[p].next[ch] == q) {
          st[p].next[ch] = clone;
          p = st[p].link;
        }
        st[q].link = clone;
        st[c].link = clone;
      }
    }
    last = c;
  }
  sa_t() {}
  sa_t(int l, int r) {
    st[0].link = -1;
    st[0].len = 0;
    for (; l < r; l++) append(a[l]);
  }
  void recalc() {
    std::memset(deg, 0, sizeof(int) * sz);
    for (int i = 0; i < sz; i++) {
      size[i] = st[i].end;
      if (i) deg[st[i].link]++;
    }
    std::queue<int> q;
    for (int i = 0; i < sz; i++)
      if (deg[i] == 0) q.push(i);
    while (!q.empty()) {
      int x = q.front();
      q.pop();
      if (x) {
        int p = st[x].link;
        size[p] += size[x];
        if ((--deg[p]) == 0) q.push(p);
      }
    }
  }
  int match(int n) {
    int c = 0;
    for (int i = 0; i < n; i++) {
      if (st[c].next.count(p[i]) == 0) return 0;
      c = st[c].next[p[i]];
    }
    return size[c];
  }
};
sa_t dp[K];
int main() {
  scanf("%s", a);
  int tlen = strlen(a);
  for (int i = 0; i < tlen; i += K) dp[i / K] = sa_t(i, std::min(i + K, tlen));
  int q;
  scanf("%d", &q);
  while (q--) {
    int c;
    std::cin >> c;
    if (c == 1) {
      int x;
      char cc;
      scanf("%d %c", &x, &cc);
      a[x - 1] = cc;
      int bucket = cc / K;
      dp[bucket] = sa_t(bucket * K, std::min(bucket * K + K, tlen));
    } else {
      int l, r;
      scanf("%d %d %s", &l, &r, p);
      --l;
      int len = strlen(p);
      if (len > r - l) {
        printf("0\n");
        continue;
      }
      int bs = l / K;
      int be = (r - 1) / K;
      do_kmp(len);
      if (len > K || r - l <= 2 * K) {
        printf("%d\n", match_kmp(l, r, len));
      } else {
        int ans = match_kmp(l, bs * K + K, len) + match_kmp(be * K, r, len);
        printf("%d\n", ans);
      }
    }
  }
  return 0;
}
