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

1
3
2

#pragma GCC optimize("O3")
#include <bits/stdc++.h>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define files(name) name!=""?freopen(name".in","r",stdin),freopen(name".out","w",stdout):0
#define all(a) a.begin(),a.end()
#define len(a) (int)(a.size())
#define elif else if
#define mp make_pair
#define pb push_back
#define fir first
#define sec second

using namespace std;
#define int long long

typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long double ld;
typedef long long ll;

const int arr=2e5+10;
const int ar=2e3+10;
const ld pi=acos(-1);
const ld eps=1e-10;
const ll md=1e9+7;

///---program start---///

typedef bitset<arr> magic;

magic vh[26];

main()
{
    #ifdef I_love_Maria_Ivanova
        files("barik");
        freopen("debug.txt","w",stderr);
    #endif

    fast;

    string s;
    cin>>s;
    for (int i=0;i<len(s);i++){
        vh[s[i]-'a'][i]=1;
    }
    int q;
    cin>>q;
    while (q--){
        int type;
        cin>>type;
        if (type==1){
            int id;
            char c;
            cin>>id>>c;
            id--;
            vh[s[id]-'a'][id]=0;
            s[id]=c;
            vh[s[id]-'a'][id]=1;
        }
        else{
            int l,r;
            string t;
            cin>>l>>r>>t;
            if (len(t)>r-l+1){
                cout<<0<<"\n";
                continue;
            }
            l--;
            r--;
            r=r-len(t)+1;
            magic cur;
            cur.set();
            for (int i=0;i<len(t);i++){
                cur&=(vh[t[i]-'a']>>i);
            }
            int res=(l==0?cur.count():(cur>>(l-1)).count())-(cur>>(r+1)).count();
            cout<<res<<"\n";
        }
    }
}
