cin >> s + 1 >> m; n = strlen(s + 1); for (int i = 1; i <= n; ++i) B[ch(s[i])].set(i); for (int i = 1; i <= m; ++i) { int opt, x, y, l; cin >> opt; if (opt == 1) { cin >> x >> c; B[ch(s[x])].reset(x); s[x] = c[0]; B[ch(s[x])].set(x); } else { cin >> x >> y >> c + 1; l = strlen(c + 1); y = y - l + 1; if (x > y) { cout << 0 << "\n"; continue; } ans.set(); for (int i = l; i; --i) { ans &= B[ch(c[i])]; if (i > 1) ans >>= 1; } ans = ans >> x << N + x - y; cout << ans.count() << "\n"; } } return0; }