#include <bits/stdc++.h>
const int MAXN = 1e5 + 19;
std::bitset<MAXN> myBit[26], ans;
int q, len;
char str[MAXN], s[MAXN];
int opt, x, l, r;
inline int up(int x) { return x > 0 ? x : 0; }
int main() {
  std::scanf("%s%d", str + 1, &q);
  len = std::strlen(str + 1);
  for (int i = 1; i <= len; ++i) myBit[str[i] - 'a'][i] = 1;
  while (q--) {
    std::scanf("%d", &opt);
    if (opt == 1) {
      std::scanf("%d%s", &x, s + 1);
      myBit[str[x] - 'a'][x] = 0;
      str[x] = s[1];
      myBit[str[x] - 'a'][x] = 1;
    } else if (opt == 2) {
      std::scanf("%d%d%s", &l, &r, s + 1);
      len = std::strlen(s + 1);
      ans.set();
      for (int i = 1; i <= len; ++i) ans &= myBit[s[i] - 'a'] >> (i - 1);
      r = r - len + 1;
      std::printf("%d\n", up(((ans >> l).count() - (ans >> (r + 1)).count())));
    }
  }
  return 0;
}
