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 namespace std;
namespace {
const long long MAX = 100002;
bitset<MAX> was[26];
void Solve(long long test) {
  (void)test;
  string str;
  cin >> str;
  for (long long i = (long long)(0); i < (long long)(((long long)(str.size())));
       ++i) {
    was[str[i] - 'a'].set(i);
  }
  long long q;
  cin >> q;
  for (long long _ = (long long)(0); _ < (long long)(q); ++_) {
    long long ty;
    cin >> ty;
    if (ty == 1) {
      long long i;
      char c;
      cin >> i >> c;
      --i;
      was[str[i] - 'a'].flip(i);
      str[i] = c;
      was[str[i] - 'a'].flip(i);
    } else {
      long long l, r;
      string y;
      cin >> l >> r >> y;
      --l, --r;
      if (((long long)(y.size())) > r - l + 1) {
        cout << 0 << '\n';
        continue;
      }
      bitset<MAX> mask, ones;
      mask.flip();
      ones.flip();
      ones <<= (r - l - ((long long)(y.size())) + 2);
      ones.flip();
      for (long long i = (long long)(0);
           i < (long long)(((long long)(y.size()))); ++i) {
        mask &= (was[y[i] - 'a'] >> i);
      }
      mask >>= l;
      mask &= ones;
      const long long res = mask.count();
      cout << res << '\n';
    }
  }
}
void Init() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
}
}  // namespace
int main() {
  Init();
  long long tests = 1;
  for (long long test = (long long)(1); test < (long long)(tests + 1); ++test)
    Solve(test);
  return 0;
}
