#include<bits/stdc++.h>
using namespace std;
#define INIT ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
#define int ll
#define MOD (999000000013)
ifstream fin("strmatch.in"); ofstream fout("strmatch.out");
#define cin fin
#define cout fout
int n ,m;
string a, b;
int h1=0, h2=0, hb=0;
int ord[300];
int32_t main(){
INIT
getline(cin, b);
getline(cin, a);
n=a.length(); m=b.length();
if(n<m){cout<<0; return 0;}
int o0=1;
for(char c='a'; c<='z'; c++){
ord[c]=o0;
o0++;
}
for(char c='A'; c<='Z'; c++){
ord[c]=o0;
o0++;
}
for(char c='0'; c<='9'; c++){
ord[c]=o0;
o0++;
}
int pw=1, bs=62;
for(int i=0; i<m; i++){
hb+=(pw*(ord[b[i] ]-ord['a']+1))%MOD; hb%=MOD;
pw*=bs; pw%=MOD;
}
//cout<<"hash_b: "<<hb<<"\n";
int pw1=1, pw2=1;
int cnt=0;
for(int i=0; i<m; i++){
h2+=(pw2*(ord[a[i] ]-ord['a']+1))%MOD; h2%=MOD;
pw2*=bs; pw2%=MOD;
}
if(h2==hb){
cnt++;
}
for(int i=m; i<n; i++){
h2-=(pw1*(ord[a[i-m] ]-ord['a']+1))%MOD; h2+=MOD; h2+=(pw2*(ord[a[i] ]-ord['a']+1))%MOD; h2%=MOD;
pw2*=bs; pw1*=bs; pw1%=MOD; pw2%=MOD;
hb*=bs; hb%=MOD;
if(hb==( h2)){ for(int j=0; j<m; j++){if(b[j]!=a[i-m+1+j]){goto Next;} }cnt++; }
Next:continue;
}
cout<<cnt;
return 0;
}