#include<iostream>
#include<algorithm>
using namespace std;
//Longest Common Prefix(s,s.substr(i)) O(|s|)
#include<vector>
#include<string>
vector<int>Zalgo(const string&s)
{
	vector<int>ret(s.size());
	if(s.empty())return ret;
	ret[0]=s.size();
	int i=1,j=0;
	while(i<s.size())
	{
		while(i+j<s.size()&&s[j]==s[i+j])j++;
		ret[i]=j;
		if(j==0)
		{
			i++;
			continue;
		}
		int k=1;
		while(i+k<s.size()&&k+ret[k]<j)ret[i+k]=ret[k],k++;
		i+=k;j-=k;
	}
	return ret;
}
string s,t;
int main()
{
	cin>>s>>t;
	vector<int>l=Zalgo(t+s);
	vector<int>L(l.begin()+t.size(),l.end());
	reverse(s.begin(),s.end());
	reverse(t.begin(),t.end());
	vector<int>r=Zalgo(t+s);
	vector<int>R(r.begin()+t.size(),r.end());
	reverse(R.begin(),R.end());
	int cnt=0;
	for(int i=0;i+t.size()<=s.size();i++)
	{
		if(L[i]+R[i+t.size()-1]==t.size()-1)cnt++;
	}
	cout<<cnt<<endl;
}

