#include "bits/stdc++.h"

using namespace std;

using i64 = long long;


template <i64 mod>
struct ModInt{
    i64 p;

    ModInt() : p(0){}
    ModInt(i64 x){p = x >= 0 ? x % mod : x + (-x + mod - 1) / mod * mod;}

    ModInt& operator+=(const ModInt& y){p = p + *y - ((p + *y) >= mod ? mod : 0); return *this;}
    ModInt& operator-=(const ModInt& y){p = p - *y + (p - *y < 0 ? mod : 0); return *this;}
    ModInt& operator*=(const ModInt& y){p = (p * *y) % mod; return *this;}
    ModInt& operator%=(const ModInt& y){if(y)p %= *y; return *this;}

    ModInt operator+(const ModInt& y) const{ModInt x = *this; return x += y;}
    ModInt operator-(const ModInt& y) const{ModInt x = *this; return x -= y;}
    ModInt operator*(const ModInt& y) const{ModInt x = *this; return x *= y;}
    ModInt operator%(const ModInt& y) const{ModInt x = *this; return x %= y;}

    friend ostream& operator<<(ostream& stream, const ModInt<mod>& x){
        stream << *x;
        return stream;
    }

    friend ostream& operator>>(ostream& stream, const ModInt<mod>& x){
        stream >> *x;
        return stream;
    }

    ModInt& operator++(){p = (p + 1) % mod; return *this;}
    ModInt& operator--(){p = (p - 1 + mod) % mod; return *this;}

    bool operator==(const ModInt& y) const{return p == *y;}
    bool operator!=(const ModInt& y) const{return p != *y;}

    const i64& operator*() const{return p;}
    i64& operator*(){return p;}

};



template<i64 mod>
bitset<300000> solve(int n, int m, vector<int> s, vector<int> t, int base){

    using mint = ModInt<mod>;

    auto mpow = [](auto x, i64 y){
        auto z = x;
        decltype(x) val = y & 1 ? x : decltype(x)(1);
        while(z *= z, y >>= 1)
            if(y & 1)
                val *= z;
        return val;
    };

    vector<mint> base_pow(n + 1, 1);
    vector<mint> base_inv(n + 1, 1);
    vector<mint> s_hash(n + 1, 0);
    mint t_hash = 0;
    unordered_map<i64, vector<int>> s_hash_map;

    for(int i = 0; i < n; ++i){
        base_pow[i + 1] = base_pow[i] * base;
        base_inv[i + 1] = mpow(base_pow[i + 1], mod - 2);
        s_hash[i + 1] = s_hash[i] + mint(s[i]) * base_pow[i];
    }

    for(int i = 0; i < m; ++i){
        t_hash += mint(t[i]) * base_pow[i];
    }

    for(int i = 0; i < n - m + 1; ++i)
        s_hash_map[*((s_hash[i + m] - s_hash[i]) * base_inv[i])].push_back(i);

    bitset<300000> bs;

    for(int i = 0; i < m; ++i){
        for(int j = 0; j < 52; ++j)
            if(t[i] != j){
                mint val = t_hash + mint(j - t[i]) * base_pow[i];
                if(s_hash_map.find(*val) != s_hash_map.end()){
                    for(auto &x : s_hash_map[*val])
                        bs.set(x);
                    s_hash_map.erase(*val);
                }
            }
    }

    return bs;
}


signed main(){
    string s, t;
    cin >> s >> t;

    int n = s.size();
    int m = t.size();
    vector<int> vs(n), vt(m);
    for(int i = 0; i < n; ++i){
        if('a' <= s[i] && s[i] <= 'z')
            vs[i] = s[i] - 'a';
        if('A' <= s[i] && s[i] <= 'Z')
            vs[i] = s[i] - 'A' + 26;
    }
    for(int i = 0; i < m; ++i){
        if('a' <= t[i] && t[i] <= 'z')
            vt[i] = t[i] - 'a';
        if('A' <= t[i] && t[i] <= 'Z')
            vt[i] = t[i] - 'A' + 26;
    }

    bitset<300000> bs;
    bs.set();
    bs &= solve<1000000007>(n, m, vs, vt, 10007);

    bs &= solve<1000000009>(n, m, vs, vt, 10007);
    bs &= solve<998244353>(n, m, vs, vt, 10007);
    bs &= solve<998244389>(n, m, vs, vt, 10007);
    /*
    bs &= solve<1000000007>(n, m, vs, vt, 10009);
    bs &= solve<1000000009>(n, m, vs, vt, 10009);
    bs &= solve<998244353>(n, m, vs, vt, 10009);
    bs &= solve<998244389>(n, m, vs, vt, 10009);
     */

    cout << bs.count() << endl;
}



Measured memory_bytes: 39408