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>
#pragma GCC optimize("O3")
using namespace std;
const int arr = 2e5 + 10;
const int ar = 2e3 + 10;
const long double pi = acos(-1);
const long double eps = 1e-10;
const long long md = 1e9 + 7;
const int K = 20;
int h[arr][K + 1];
string s;
string t;
inline bool cmp(int start, int l) {
  int p = 0;
  while (p + 3 < l) {
    if (s[start++] != t[p++]) {
      return 0;
    }
    if (s[start++] != t[p++]) {
      return 0;
    }
    if (s[start++] != t[p++]) {
      return 0;
    }
    if (s[start++] != t[p++]) {
      return 0;
    }
  }
  while (p < l) {
    if (s[start++] != t[p++]) {
      return 0;
    }
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> s;
  for (int i = 0; i < (int)(s.size()); i++) {
    for (int j = 1; i + j - 1 < (int)(s.size()) && j <= K; j++) {
      h[i][j] = h[i][j - 1] * 31 + (s[i + j - 1] - 'a' + 1);
    }
  }
  int q;
  cin >> q;
  while (q--) {
    int type;
    cin >> type;
    if (type == 1) {
      int id;
      char c;
      cin >> id >> c;
      id--;
      s[id] = c;
      for (int i = max(0, i - K); i <= id; i++) {
        for (int j = 1; i + j - 1 < (int)(s.size()) && j <= K; j++) {
          h[i][j] = h[i][j - 1] * 31 + (s[i + j - 1] - 'a' + 1);
        }
      }
    } else {
      int l, r;
      cin >> l >> r >> t;
      l--;
      r--;
      int cur_len = (int)(t.size());
      if (cur_len > r - l + 1) {
        cout << 0 << "\n";
        continue;
      }
      if (cur_len <= K) {
        int ans = 0;
        int want_hash = 0;
        for (auto j : t) {
          want_hash = want_hash * 31 + (j - 'a' + 1);
        }
        for (int i = l; i + cur_len - 1 <= r; i++) {
          ans += (want_hash == h[i][cur_len]);
        }
        cout << ans << " !\n";
      } else {
        r -= cur_len;
        r++;
        int ans = 0;
        for (int i = l; i <= r; i++) {
          ans += cmp(i, cur_len);
        }
        cout << ans << "\n";
      }
    }
  }
}
