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;
long long inf = 1000 * 1000 * 1000 + 7;
long long inf64 = inf * inf;
long long mod = 228228227;
long long math_mod = 998244353;
float START_TIME;
mt19937 gen(time(0));
bitset<100005> a[27], one, ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cerr << fixed << setprecision(15);
  cout << fixed << setprecision(15);
  srand(time(0));
  START_TIME = clock();
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); ++i) one[i] = 1;
  for (int i = 0; i < s.size(); ++i) a[s[i] - 'a'][i] = 1;
  int m;
  cin >> m;
  for (int i = 0; i < m; ++i) {
    int k;
    cin >> k;
    if (k == 1) {
      int pos;
      char c;
      cin >> pos >> c;
      a[s[pos - 1] - 'a'][pos - 1] = 0;
      a[c - 'a'][pos - 1] = 1;
      s[pos - 1] = c;
    } else {
      int l, r;
      cin >> l >> r;
      string st;
      cin >> st;
      int len = st.size();
      if (len > r - l + 1) {
        cout << 0 << endl;
        continue;
      } else {
        ans = one;
        for (int i = 0; i < len; ++i) ans &= (a[st[i] - 'a'] >> i);
        int res = (ans >> (l - 1)).count() - (ans >> (r - len + 1)).count();
        cout << res << endl;
      }
    }
  }
  cerr << endl << (clock() - START_TIME) / CLOCKS_PER_SEC << " sec." << endl;
}
