#include <bits/stdc++.h>
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
const int maxn = 1e5 + 10;
std::bitset<maxn> mask[26];
int main() {
  std::ios::sync_with_stdio(false);
  std::string in;
  std::cin >> in;
  for (size_t i = 0; i < in.length(); i++) mask[in[i] - 'a'][i] = 1;
  int q;
  std::cin >> q;
  while (q--) {
    int c;
    std::cin >> c;
    if (c == 1) {
      int x;
      char ch;
      std::cin >> x >> ch;
      --x;
      mask[in[x] - 'a'][x] = 0;
      in[x] = ch;
      mask[ch - 'a'][x] = 1;
    } else {
      int l, r;
      std::string pat;
      std::cin >> l >> r >> pat;
      --l;
      if (r - l < (int)pat.length()) {
        std::cout << "0\n";
        continue;
      }
      auto test = std::bitset<maxn>{}.set();
      for (size_t i = 0; i < pat.length(); i++) test &= mask[pat[i] - 'a'] >> i;
      int ans = (test >> l).count() - (test >> (r - pat.length() + 1)).count();
      std::cout << ans << "\n";
    }
  }
  return 0;
}
