#include<bits/stdc++.h>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

const int IINF = INT_MAX;

class RMQ{
private:
  int limit,N;
  vector<int> dat;
public:
  void init(int n_){
    N = n_;
    limit = 1;
    while(limit<n_)limit*=2;
    dat.clear();
    dat.resize(2*limit,IINF);
  }
  
  int _build(int cur,int L,int R,const vector<int> &buf){
    if( !( 0 <= cur && cur < 2*limit ) ) return IINF;
    if( L == R-1 ) {
      if( L >= N ) return IINF;
      dat[cur] = buf[L];
    } else {
      int vl = _build(cur*2+1,L,(L+R)/2,buf);
      int vr = _build(cur*2+2,(L+R)/2,R,buf);
      dat[cur] = min(vl,vr);
    }
    return dat[cur];
  }

  void build(const vector<int> &buf){ _build(0,0,limit,buf); };
 
  int _query(int a,int b,int k,int l,int r){
    if(r<=a || b<=l)return IINF;
    else if(a<=l && r<=b)return dat[k];
    int vl = _query(a,b,k*2+1,l,(l+r)/2);
    int vr = _query(a,b,k*2+2,(l+r)/2,r);
    return min(vl,vr);
  }

  int query(int a,int b){ return _query(a,b,0,0,limit); }
};

string s,t;
vector<int> SuffixArray,LCP,vec;
RMQ rmq;

struct CompareSA{
  int k;
  const vector<int> &rank;
  CompareSA(const int k,const vector<int> &rank) : k(k), rank(rank){}
  bool operator()(int i,int j) {
    if( rank[i] != rank[j] ) return rank[i] < rank[j];
    int ri = i + k < (int)rank.size() ? rank[i+k] : -1;
    int rj = j + k < (int)rank.size() ? rank[j+k] : -1;
    return ri < rj;
  }
};
  
vector<int> build_sa(const string &s){
  int n = s.size();
  vector<int> sa(n+1), rank(n+1), tmp(n+1);
  rep(i,sa.size()){
    sa[i] = i;
    rank[i] = i < n ? s[i] : -1;
  }
  for(int k=1;k<=n;k*=2){
    CompareSA comp(k,rank);
    sort(sa.begin(),sa.end(),comp);
    tmp[sa[0]] = 0;
    for(int i=1;i<=n;i++) tmp[sa[i]] = tmp[sa[i-1]] + comp(sa[i-1],sa[i]);
    rank = tmp;
  }
  return sa;
}
  
vector<int> build_lcp(const string &s,vector<int> sa){
  int n = s.size(), h = 0;
  vector<int> rank(n+1), lcp(n+1);
  rep(i,n+1) rank[sa[i]] = i;
  rep(i,n) {
    int j = sa[rank[i]-1];
    if( h > 0 ) h--;
    for(; j + h < n && i + h < n; h++ ) if( s[j+h] != s[i+h] ) break;
    lcp[rank[i]-1] = h;
  }
  return lcp;
}

inline bool isValid(int a,int b,int c,int d){
  if( ( b - a ) != ( d - c ) ) return false;
  if( a == c && b == d ) return true;
  /*
  puts("__________________________");
  cout << a << " " <<b << " " << c << " " << d << endl;
  */
  int p1 = a, p2 = c, diff = 0;
  while( diff <= 1 && a <= b ){
    int L1 = vec[a];
    int L2 = vec[c];
    /*
    cout << a << ", " << b << " " << c << ", " << d << endl;
    cout << "L1 = " << L1 << ", R1 = " << R1 << endl;
    cout << "L2 = " << L2 << ", R2 = " << R2 << endl;
    */
    int coef = rmq.query(min(L1,L2),max(L1,L2));
    //cout << "coef = " << coef << endl;
    if( coef == 0 ) {
      ++diff, ++a, ++c;
      continue;
    }
    a += coef, c += coef;

  }
  return diff == 1;
  //if( diff > 1 ) return false;
  //return true;
}


int main(){
  cin >> s >> t;
  int n = s.size(), m = t.size();
  s = s + "$" + t + "$";
  SuffixArray = build_sa(s);
  LCP         = build_lcp(s,SuffixArray);
  vec.resize(SuffixArray.size()+1,-1);
  rmq.init(LCP.size());
  rmq.build(LCP);

  rep(i,SuffixArray.size()) vec[SuffixArray[i]] = i;

  /*  
  rep(i,LCP.size()) {
    cout << i << setw(3) << ":" << setw(3) << LCP[i] << setw(3) << ": " << s.substr(SuffixArray[i]) << endl;
  }
  */
  int answer = 0;
  rep(i,n-m+1) if( isValid(i,i+m-1,n+1,n+1+m-1) ) ++answer;
  cout << answer << endl;
  return 0;
}

Measured memory_bytes: 12952