#include <bits/stdc++.h>
using namespace std;
int n, m, op, x, y, l, i, j, a[100001];
bitset<100001> V[26], I, an;
char s[100001];
int main() {
  scanf("%s", s);
  n = strlen(s);
  for (i = 0; i < n; i++) V[s[i] - 'a'][i] = 1, I[i] = 1;
  for (scanf("%d", &m); m--;) {
    scanf("%d%d", &op, &x);
    if (op == 1)
      for (scanf("%s", s), i = 0; i < 26; i++)
        V[i][x - 1] = ((s[0] - 'a' == i) ? 1 : 0);
    else {
      scanf("%d%s", &y, s);
      l = strlen(s);
      an = (I >> (n - y + x + l - 2)) << (x - 1);
      for (i = 0; i < l; an <<= 1, i++) an &= V[s[i] - 'a'];
      printf("%d\n", an.count());
    }
  }
}
