// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

// Rolling Hash
// Verified: AOJ 2444 (Substring)

struct RollingHash {
public:
    long long base_1, base_2, mod_1, mod_2;
    vector<long long> hash1, hash2, pow1, pow2;

    // init (constructor)
    RollingHash(string s) : base_1(1013), base_2(1007),
        mod_1(1000000007), mod_2(1000000009),
        hash1(s.length()+1,0), hash2(s.length()+1,0),
        pow1(s.length()+1,1), pow2(s.length()+1,1) {
            for(int i=0; i<s.length(); i++) {
                hash1[i+1] = (hash1[i]+s[i]) * base_1 % mod_1;
                hash2[i+1] = (hash2[i]+s[i]) * base_2 % mod_2;
                pow1[i+1] = pow1[i] * base_1 % mod_1;
                pow2[i+1] = pow2[i] * base_2 % mod_2;
            }
        }

    // calc str[l,r) hash (0-indexed)
    // if get(i1,j1) == get(i2,j2) -> identical string
    pair<long long, long long> get(int l, int r) {
        long long t1 = ((hash1[r] - hash1[l] * pow1[r-l]) % mod_1 + mod_1) % mod_1;
        long long t2 = ((hash2[r] - hash2[l] * pow2[r-l]) % mod_2 + mod_2) % mod_2;
        return make_pair(t1, t2);
    }
};

signed main() {
    string s, t; cin >> s >> t;
    int N = s.length(), M = t.length();
    RollingHash rs(s), rt(t);

    int ans = 0;
    for(int i=0; i<N-M+1; i++) {
        int x; // 先頭何文字一致しているか？
        {
            int ub = M+1, lb = 0;
            while(ub - lb > 1) {
                int mid = (ub + lb) / 2;
                int isl = i, isr = i + mid;
                int itl = 0, itr = mid;
                if(rs.get(isl, isr) == rt.get(itl, itr)) {
                    lb = mid;
                }
                else {
                    ub = mid;
                }
            }
            x = lb;
        }
        if(x == M) continue;
        
        {
            // x 文字一致、残り M - x - 1 文字について調べたい
            int ub = M - x, lb = 0;
            while(ub - lb > 1) {
                int mid = (ub + lb) / 2;
                int isl = i + x + 1, isr = i + x + 1 + mid;
                int itl = x + 1, itr = x + 1 + mid;
                if(rs.get(isl, isr) == rt.get(itl, itr)) {
                    lb = mid;
                }
                else {
                    ub = mid;
                }
            }

            if(lb == M - x - 1) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 17624