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 state_t {
  std::map<char, int> next;
  int link = 0, len = 0;
  char end = 0;
};
struct {
  state_t st[K * 2];
  int size[K * 2];
  int deg[K * 2];
  int last = -1;
  int sz = 0;
} dp[K];
inline void append(int i, char ch) {
  int c = dp[i].sz++;
  int p = dp[i].last;
  dp[i].st[c].end = 1;
  dp[i].st[c].len = dp[i].st[dp[i].last].len + 1;
  while (p > -1 && dp[i].st[p].next.count(ch) == 0) {
    dp[i].st[p].next[ch] = c;
    p = dp[i].st[p].link;
  }
  if (p == -1) {
    dp[i].st[c].link = 0;
  } else {
    int q = dp[i].st[p].next[ch];
    if (dp[i].st[q].len == dp[i].st[p].len + 1) {
      dp[i].st[c].link = q;
    } else {
      int clone = dp[i].sz++;
      dp[i].st[clone] = dp[i].st[q];
      dp[i].st[clone].len = dp[i].st[p].len + 1;
      dp[i].st[clone].end = 0;
      while (p > -1 && dp[i].st[p].next[ch] == q) {
        dp[i].st[p].next[ch] = clone;
        p = dp[i].st[p].link;
      }
      dp[i].st[q].link = clone;
      dp[i].st[c].link = clone;
    }
  }
  dp[i].last = c;
}
void reset(int i, int l, int r) {
  for (int j = 0; j < dp[i].sz; i++) {
    dp[i].st[j] = state_t();
  }
  dp[i].sz = 1;
  dp[i].last = 0;
  dp[i].st[0].link = -1;
  dp[i].st[0].len = 0;
  for (; l < r; l++) {
    append(i, a[l]);
  }
}
void recalc(int i) {
  std::memset(dp[i].deg, 0, sizeof(int) * dp[i].sz);
  for (int i = 0; i < dp[i].sz; i++) {
    dp[i].size[i] = dp[i].st[i].end;
    if (i) dp[i].deg[dp[i].st[i].link]++;
  }
  std::queue<int> q;
  for (int i = 0; i < dp[i].sz; i++)
    if (dp[i].deg[i] == 0) q.push(i);
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    if (x) {
      int p = dp[i].st[x].link;
      dp[i].size[p] += dp[i].size[x];
      if ((--dp[i].deg[p]) == 0) q.push(p);
    }
  }
}
int match(int i, int n) {
  int c = 0;
  for (int i = 0; i < n; i++) {
    if (dp[i].st[c].next.count(p[i]) == 0) return 0;
    c = dp[i].st[c].next[p[i]];
  }
  return dp[i].size[c];
}
int main() {
  scanf("%s", a);
  int tlen = strlen(a);
  for (int i = 0; i < tlen; i += K) reset(i / K, 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 = (x - 1) / K;
    } 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;
}
