#include <bits/stdc++.h>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()

typedef unsigned long long ull;
const ull c = 1145148931919LL;

ull ro[1000100];
ull tei[1000100];
int nn;
bool check(int a, int b, int c, int d) {
	if(a < 0 || c < 0) return false;
	if(nn <= b || nn <= d) return false;
	ull aa = ro[b];
	ull bb = ro[d];
	if(a) aa += -ro[a - 1] * tei[b - a + 1];
	if(c) bb += -ro[c - 1] * tei[d - c + 1];
	return aa == bb;
}

vector<int> calc_z(string s){
	int n = s.size();
	vector<int> z(n,0);
	int l=0,r=0;
	for(int i=1;i<s.size();i++){
		if(i>r){
			l=r=i;
			while(r<n&&s[r-l]==s[r]) r++;
			z[i]=r-l;
			r--;
		}
		else{
			if(z[i-l]<r-i+1){
				z[i]=z[i-l];
			}
			else{
				l=i;
				r++;
				while(r<n&&s[r-l]==s[r]) r++;
				z[i]=r-l;
				r--;
			}
		}
	}
	return z;
}


template<class T>
struct RollingHash {
	static const int NN = 2; // the number of hash table
	T base[NN] = {1009, 1007};
	T PMOD[NN] = {1000000007, 1000000009};
	vector<T> hash[NN];
	vector<T> mypow[NN];
	int sz;
	void init(string s) {
		sz = s.size();
		for(int i = 0; i < NN; i++) {
			hash[i].assign(sz + 1, 0);
			mypow[i].assign(sz + 1, 0);
			mypow[i][0] = 1;
		}
		for(int i = 0; i < NN; i++) {
			for(int j = 0; j < sz; j++) {
				hash[i][j + 1] = (hash[i][j] * base[i] + s[j]) % PMOD[i];
				mypow[i][j + 1] = mypow[i][j] * base[i] % PMOD[i];
			}
		}
	}
	RollingHash() {
	}
	// hash[t] value of s[l..r]
	T get(int l, int r, int t) {
		T ret = (hash[t][r + 1] - hash[t][l] * mypow[t][r - l + 1] % PMOD[t] + PMOD[t]) % PMOD[t];
		return ret;
	}
	// compare s[a..b] and s[c..d] O(1)
	bool comp(int a, int b, int c, int d) {
		if(a < 0 || sz <= b || c < 0 || sz <= d) return false;
		for(int i = 0; i < NN; i++) {
			if(get(a, b, i) != get(c, d, i)) return false;
		}
		return true;
	}
	// longest common extension s[l..LCE(l,r)] == s[r..LCE(l,r)] && s[l..LCE(l,r)+1] != s[r..LCE(l,r)+1]
	int LCE(int l,int r){
		tie(l,r)=minmax(l,r);
		if(l==r) return sz-r+1;
		int ll = 0;
		int rr = sz;
		while(rr-ll>1){
			int mid = (ll+rr)>>1;
			if(comp(l,l+mid-1,r,r+mid-1)) ll=mid;
			else rr=mid;
		}
		return ll;
	}
};

RollingHash<long long> rhash1;

int calc1(int l, int r) {
	return rhash1.LCE(l,r);
	int ll = 0;
	int rr = INT_MAX / 10;
	while(rr - ll > 1) {
		int mid = (ll + rr) / 2;
		if(rhash1.comp(l, l + mid - 1, r, r + mid - 1)) {
			ll = mid;
		}
		else {
			rr = mid;
		}
	}
	return ll;
}

int calc2(int l, int r) {
	int ll = 0;
	int rr = INT_MAX / 10;
	while(rr - ll > 1) {
		int mid = (ll + rr) / 2;
		if(rhash1.comp(l - mid + 1, l, r - mid + 1, r)) {
			ll = mid;
		}
		else {
			rr = mid;
		}
	}
	return ll;
}

int main() {
	string s, t;
	cin >> s >> t;
	string a = t+s;
	nn = a.size();
	int n = s.size();
	int m = t.size();
	int ans = 0;
	reverse(ALL(t));
	reverse(ALL(s));
	string b = t+s;
	vector<int> z1=calc_z(a);
	vector<int> z2=calc_z(b);
	rep(i, n) {
		if(i + m - 1 >= n) break;
		int l = z1[m+i];
		int r = z2[n-i];
		if(l + r + 1 == m) ans++;
	}
	cout << ans << endl;
}