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;
using ll = long long;
const int inf = 0x3f3f3f3f;
const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;
const int N = 1565;
using ull = unsigned long long;
struct Bitset {
  ull b[N];
  Bitset() { reset(); }
  void set() { memset(b, 0xff, sizeof b); }
  void set(int k) { b[k >> 6] |= 1LL << (k & 63); }
  void reset() { memset(b, 0, sizeof b); }
  void reset(int k) { b[k >> 6] &= ~(1LL << (k & 63)); }
  bool get(int k) { return (b[k >> 6] >> (k & 63)) & 1; }
  Bitset operator>>(int k) {
    if (k == 0) return *this;
    Bitset ret;
    int pos = N - 1 - ((k + 63) >> 6), s = (64 - (k & 63)) & 63, t = 64 - s;
    for (int i = N - 1; i >= 0 && pos >= -1; i--) {
      if (pos >= 0) ret.b[i] = (b[pos] >> s);
      if (s) ret.b[i] |= (b[pos + 1] << t);
      pos--;
    }
    return ret;
  }
  Bitset operator<<(int k) {
    if (k == 0) return *this;
    Bitset ret;
    int pos = (k + 63) >> 6, s = (k & 63), t = (64 - s) & 63;
    for (int i = 0; pos <= N; i++, pos++) {
      if (pos < N) ret.b[i] = b[pos] << t;
      if (s) ret.b[i] |= (b[pos - 1]) >> s;
    }
    return ret;
  }
  void operator&=(const Bitset& o) {
    for (int i = 0; i < N; i++) b[i] &= o.b[i];
  }
  int count(int l, int r) {
    int pl = l >> 6, pr = r >> 6;
    if (pl == pr) {
      int s = l & 63, d = r - l + 1;
      return __builtin_popcountll((b[pl] >> s) & (((ull)1 << d) - 1));
    }
    int s = l & 63, t = r & 63;
    int ans = __builtin_popcountll((b[pl] >> s));
    for (int i = pl + 1; i < pr; i++) ans += __builtin_popcountll(b[i]);
    return ans + __builtin_popcountll(b[pr] & (((ull)1 << (t + 1)) - 1));
  }
  void output(int k) {
    for (int i = 0; i < k; i++) cout << get(i);
    cout << "\n";
  }
} b[26], ans;
string s, t;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> s;
  int n = s.size(), q;
  for (int i = 0; i <= n - 1; i++) {
    b[s[i] - 'a'].set(i);
  }
  cin >> q;
  while (q--) {
    int op, l, r, pos;
    char c;
    cin >> op;
    if (op == 1) {
      cin >> pos >> c;
      pos--;
      b[s[pos] - 'a'].reset(pos);
      s[pos] = c;
      b[c - 'a'].set(pos);
    } else {
      cin >> l >> r >> t;
      int m = t.size();
      if (r - l + 1 < m) {
        cout << 0 << "\n";
        continue;
      }
      l--;
      r--;
      ans = b[t[0] - 'a'];
      for (int i = 1; i < m; i++) {
        ans &= (b[t[i] - 'a'] << i);
      }
      cout << ans.count(l, r - m + 1) << "\n";
    }
  }
  return 0;
}
