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;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f3f3f3f3f3f3fll;
const long long M = 1e9 + 7;
const long long maxn = 1e5 + 7;
const double eps = 0.00000001;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template <typename T>
inline T abs(T a) {
  return a > 0 ? a : -a;
}
template <typename T>
inline T powMM(T a, T b) {
  T ret = 1;
  for (; b; b >>= 1ll, a = 1ll * a * a % M)
    if (b & 1) ret = 1ll * ret * a % M;
  return ret;
}
int n, q;
bitset<maxn> T[26], now;
char a[maxn], b[maxn];
int i;
int main() {
  scanf("%s", a);
  n = strlen(a);
  for (i = 0; i < n; i++) T[a[i] - 'a'].set(i);
  scanf("%d", &q);
  while (q--) {
    int op;
    scanf("%d", &op);
    if (op == 1) {
      int pos;
      char c;
      scanf("%d%*c%c", &pos, &c);
      pos--;
      T[a[pos] - 'a'][pos] = 0;
      a[pos] = c;
      T[a[pos] - 'a'][pos] = 1;
    } else {
      int l, r;
      scanf("%d%d%s", &l, &r, b);
      int len = strlen(b);
      if (len > r - l + 1)
        puts("0");
      else {
        now.set();
        now = (now >> (l - 1)) << (l - 1);
        now = (now << (maxn - (r - len + 1))) >> (maxn - (r - len + 1));
        for (i = 0; i < len; i++) now &= (T[b[i] - 'a'] >> i);
        printf("%d\n", (int)now.count());
      }
    }
  }
}
