#include <bits/stdc++.h>
using namespace std;
const long long inf = 2e9;
const long long mod = 998244353;
const int maxn = 1e5 + 50;
bitset<maxn> s[27], ans;
char a[maxn], b[maxn];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> a + 1;
  int len = strlen(a + 1);
  for (int i = 1; i <= len; i++) s[a[i] - 'a'].set(i);
  int q;
  cin >> q;
  while (q--) {
    int op;
    cin >> op;
    if (op == 1) {
      int x;
      char ch;
      cin >> x >> ch;
      s[a[x] - 'a'][x] = 0;
      s[(a[x] = ch) - 'a'][x] = 1;
    } else {
      ans.set();
      int l, r;
      cin >> l >> r;
      cin >> b;
      int len1 = strlen(b);
      if (len1 > (r - l + 1)) {
        cout << 0 << '\n';
        continue;
      }
      for (int i = 0; i < len1; i++) {
        ans &= (s[b[i] - 'a'] >> i);
      }
      int num1 = (ans >> (l)).count();
      int num2 = (ans >> (r - len1 + 2)).count();
      cout << num1 - num2 << '\n';
    }
  }
  return 0;
}
