#include <bits/stdc++.h>
using namespace std;
namespace Primary {
const int maxn = 1e5 + 10;
char s[maxn], t[maxn];
int q;
bitset<maxn> help[26], ans;
void main() {
  scanf("%s%d", s, &q);
  int len = strlen(s);
  for (int i = 0; i < len; ++i) help[s[i] - 'a'].set(i);
  int opt, ql, qr;
  while (q--) {
    scanf("%d", &opt);
    if (opt == 1) {
      scanf("%d%s", &ql, t), --ql;
      help[s[ql] - 'a'].set(ql, 0);
      help[t[0] - 'a'].set(ql);
      s[ql] = t[0];
    } else {
      scanf("%d%d%s", &ql, &qr, t);
      len = strlen(t);
      if (len > qr - ql + 1) {
        puts("0");
        continue;
      }
      ans.set();
      for (int i = 0; i < len; ++i) ans &= (help[t[i] - 'a'] >> i);
      int ans_l = (ans >> (ql - 1)).count();
      int ans_r = (ans >> (qr - len + 1)).count();
      printf("%d\n", ans_l - ans_r);
    }
  }
}
}  // namespace Primary
int main() {
  Primary::main();
  return 0;
}
