abcdabcdab
5
2 2 8 ab
2 1 10 ab
1 3 a
1 4 b
2 1 4 ab

1
3
2

//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
//~ #pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define SZ(x) ((int)(x).size())
#define ALL(x) x.begin(),x.end()
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define _upgrade ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define erase_duplicates(x) sort(all(x)); (x).resize(distance((x).begin(), unique(all(x))));


using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<
T,
null_type,
less<T>,
rb_tree_tag,
tree_order_statistics_node_update>;

//X.find_by_order(k); - zwraca iterator na k-ty element (numeracja od zerowego)
//X.order_of_key(k); - zwraca liczbę elementów ostro mniejszych niż k

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<LL> VLL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long double LD;
typedef pair<LD,LD> PLD;
typedef vector<LD> VLD;
typedef vector<PLD> VPLD;

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<" = "<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<" = "<<h<<", "; _dbg(sdbg+1, a...);
}

#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#define cerr if(0)cout
#endif

const int maxn = (1e6)+7;
const int maxk = 20;
const int inf = (1e9)+7;
const LL LLinf = ((LL)1e18)+7LL;
const LD eps = 1e-9;
const LL mod = 1e9+7;

// ***************************** CODE ***************************** //

const int pier = 400;

string wzo;

/*
 * Autor programu: Marek Cygan
 * data:           17.03.2005
 * Program ilustrujacy liczenie tablicy PREF.
 * Wartoscia PREF[i] jest dlugosc najdluzszego
 * prefiksu calego slowa, ktory wystepuje w slowie
 * rozpoczynajac od i-tej litery
 */

struct PREF
{
  vector<int> PREF; // tutaj znajduje sie wynik
  int n; //dlugosc slowa
  string X; //slowo, dla ktorego bedziemy obliczac wartosci tablicy PREF
  //funkcja ta zwraca dlugosc najdluzszego
  //prefiksu slowa X, zaczynajacego sie na
  //pozycji j, zakladajac ze przed pozycja k
  //prefiks jest zgodny
  int pref(int j,int k)
  {
    k=max(k,j);
    int i=k-j;
    while (k<=n && X[i]==X[k-1]) { i++;  k++; }
    return k-j;
  }

  //procedura obliczaja kolejne wartosci tablicy PREF
  //w czasie liniowym
  void run(string s)
  {
    X = s;
    n = SZ(X);
    int i=1;
    PREF.resize(n + 3, 0);
    PREF[1]=-1;
    for (int j=2; j<=n; ++j)
    { int l=j-i+1;
      if (l<=PREF[i] && j+PREF[l]<i+PREF[i])
        PREF[j]=PREF[l];
      else
       { PREF[j]=pref(j,i+PREF[i]);
         i=j;
       }
    }
  }
};


struct SuffixAutomaton {
  int edges[26][1000], link[1000], length[1000], isTerminal[1000], dp1[1000], last;
  int sz;
  SuffixAutomaton() {
    last = 0;
    sz = 0;
  }

  void set(int k) {
    for(int i = 0; i < 26; ++i) edges[i][k] = -1;
  }

  void build(string s) {
    link[0] = -1;
    length[0] = 0;
    last = 0;
    sz = 1;
    set(0);
    // dbg(SZ(s));
    for(int i=0;i<s.size();i++) {
      set(sz);
      length[sz] = i+1;
      link[sz] = 0;
      int r = sz;
      ++sz;

      int p = last;
      while(p >= 0 && edges[s[i]-'a'][p] == -1) {
        edges[s[i] - 'a'][p] = r;
        p = link[p];
      }
      if(p != -1) {
        int q = edges[s[i] - 'a'][p];
        if(length[p] + 1 == length[q]) {
          link[r] = q;
        } else {
          for(int i = 0; i < 26; ++i) {
            edges[i][sz] = edges[i][q];
          }
          length[sz] = length[p] + 1;
          link[sz] = link[q];
          int qq = sz;
          ++sz;
          link[q] = qq;
          link[r] = qq;
          while(p >= 0 && edges[s[i] - 'a'][p] == q) {
            edges[s[i] - 'a'][p] = qq;
            p = link[p];
          }
        }
      }
      last = r;
    }
    for(int i = 0; i < sz; ++i) isTerminal[i] = 0, dp1[i] = -1;
    int p = last;
    while(p > 0) {
      isTerminal[p] = 1;
      p = link[p];
    }
  }

  int solve(int pos) {
    if(dp1[pos] != -1) return dp1[pos];
    dp1[pos] = isTerminal[pos];
    for(int i=0; i<26; ++i){
      if(edges[i][pos] != -1) dp1[pos] += solve(edges[i][pos]);
    }
    return dp1[pos];
  }

  int run(string sq) {
    int cur = 0;
    for(int i=0; i < SZ(sq); ++i) {
      auto it = edges[sq[i] - 'a'][cur];
      if(it == -1) return 0;
      else cur = it;
    }
    // cerr<<cur<<endl;
    return solve(cur);
  }
} SA[800];

int brute(int l, int p, string s)
{
  // dbg("xd", l, p, SZ(s));
  string xd = s + "#" + wzo.substr(l - 1, min(SZ(wzo) - l + 1, p - l + SZ(s)));
  PREF tmp;
  tmp.run(xd);
  int res = 0;
  for(auto v : tmp.PREF)
    if(v == SZ(s))
      res++;
  // dbg("elo");
  return res;

}

int licz(int l, int p, string s)
{
  if(SZ(s) >= pier || (p - l) <= 2 * pier)
    return brute(l, p, s);
  else
  {
    int L = l;
    while(L % pier != 0)
      L++;
    int P = p;
    while(P % pier != pier - 1)
      P--;
    int res = (l <= L - 1 ? brute(l, L - 1, s) : 0) + (P + 1 <= p ? brute(P + 1, p, s) : 0);
    l = L;
    p = P;
    l /= pier;
    p /= pier;
    while(l <= p)
    {
      res += SA[l].run(s);
      l++;
    }
    return res;
  }
}

int main()
{
	_upgrade
  cin>>wzo;
  for(int i = 0;i < SZ(wzo);i += pier)
    SA[i / pier].build(wzo.substr(i, min(SZ(wzo) - 1, i + pier) - i));
  int q;
  cin>>q;
  // dbg(q);
  for(int i = 1;i <= q;i++)
  {
    // dbg(i);
    int t;
    cin>>t;
    if(t == 1)
    {
      int pos;
      cin>>pos;
      char a;
      cin>>a;
      wzo[pos - 1] = a;
      int kub = (pos - 1) / pier;
      int l = pier * kub;
      int p = min(SZ(wzo) - 1, pier * kub + pier - 1);
      SA[kub].build(wzo.substr(l, p - l + 1));
    }
    else
    {
      int l, p;
      string s;
      cin>>l>>p>>s;
      cout<<licz(l, p - SZ(s) + 1, s)<<"\n";
    }
  }

	return 0;
}
