#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <cassert>
#include <ctime>

#include <iostream>
#include <utility>
#include <algorithm>

#include <vector>
#include <string>
#include <set>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <bitset>
#include <stack>

#define mp make_pair
#define pb push_back
#define fs first
#define sc second
#define sz(x) ((int)((x).size()))
#define all(x) ((x).begin()),((x).end())
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define forn(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)

using namespace std;

const double eps = 1e-10, inf = 1e10;
typedef long long ll;

char a[2100], b[2100], c[2100];
int indc[2100], indb[2100], la, lb, lc;

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("in","r",stdin);
    #endif

    scanf("%s\n%s\n%s\n", a+1, b+1, c+1);
    la = strlen(a+1);
    lb = strlen(b+1);
    lc = strlen(c+1);
    indb[1]=0;
    int k=0, q;
    for (q=2; q<=lb; q++)
    {
        while (k>0 && b[k+1]!=b[q]) k=indb[k];
        if (b[k+1]==b[q]) k++;
        indb[q]=k;
    }
    q=k=0;
    indc[1]=0;
    for (q=2; q<=lc; q++)
    {
        while (k>0 && c[k+1]!=c[q]) k=indc[k];
        if (c[k+1]==c[q]) k++;
        indc[q]=k;
    }
    vector<int> matchb, matchc;
    q=0;
    forn(i, 1, la)
    {
        while (q>0 && b[q+1]!=a[i]) q=indb[q];
        if (b[q+1]==a[i]) q++;
        if (q==lb)
        {
            matchb.pb(i-lb+1);
            q=indb[q];
        }
    }
    q=0;
    forn(i, 1, la)
    {
        while (q>0 && c[q+1]!=a[i]) q=indc[q];
        if (c[q+1]==a[i]) q++;
        if (q==lc)
        {
            matchc.pb(i);
            q=indc[q];
        }
    }
    /*rep(i, sz(matchb)) cout << matchb[i] << ' ';
    cout << '\n';
    rep(i, sz(matchc)) cout << matchc[i] << ' ';
    cout << '\n';*/

    set<string> st;
    int ans=0; string tmp;
    rep(i, sz(matchb))
    {
        rep(j, sz(matchc))
            if (matchc[j]-lc+1 >= matchb[i])
            {
                tmp = "";
                for (int k=matchb[i]; k<=matchc[j]; k++) tmp += a[k];
                st.insert(tmp);
            }
    }
    cout << sz(st) << '\n';
    return 0;
}


#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <cassert>
#include <ctime>

#include <iostream>
#include <utility>
#include <algorithm>

#include <vector>
#include <string>
#include <set>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <bitset>
#include <stack>

#define mp make_pair
#define pb push_back
#define fs first
#define sc second
#define sz(x) ((int)((x).size()))
#define all(x) ((x).begin()),((x).end())
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define forn(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)

using namespace std;

const double eps = 1e-10, inf = 1e10;
typedef long long ll;

char a[2100], b[2100], c[2100];
int indc[2100], indb[2100], la, lb, lc;

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("in","r",stdin);
    #endif

    scanf("%s\n%s\n%s\n", a+1, b+1, c+1);
    la = strlen(a+1);
    lb = strlen(b+1);
    lc = strlen(c+1);
    indb[1]=0;
    int k=0, q;
    for (q=2; q<=lb; q++)
    {
        while (k>0 && b[k+1]!=b[q]) k=indb[k];
        if (b[k+1]==b[q]) k++;
        indb[q]=k;
    }
    q=k=0;
    indc[1]=0;
    for (q=2; q<=lc; q++)
    {
        while (k>0 && c[k+1]!=c[q]) k=indc[k];
        if (c[k+1]==c[q]) k++;
        indc[q]=k;
    }
    vector<int> matchb, matchc;
    q=0;
    forn(i, 1, la)
    {
        while (q>0 && b[q+1]!=a[i]) q=indb[q];
        if (b[q+1]==a[i]) q++;
        if (q==lb)
        {
            matchb.pb(i-lb+1);
            q=indb[q];
        }
    }
    q=0;
    forn(i, 1, la)
    {
        while (q>0 && c[q+1]!=a[i]) q=indc[q];
        if (c[q+1]==a[i]) q++;
        if (q==lc)
        {
            matchc.pb(i);
            q=indc[q];
        }
    }
    /*rep(i, sz(matchb)) cout << matchb[i] << ' ';
    cout << '\n';
    rep(i, sz(matchc)) cout << matchc[i] << ' ';
    cout << '\n';*/

    set<string> st;
    int ans=0; string tmp;
    rep(i, sz(matchb))
    {
        rep(j, sz(matchc))
            if (matchc[j] > matchb[i])
            {
                tmp = "";
                for (int k=matchb[i]; k<=matchc[j]; k++) tmp += a[k];
                st.insert(tmp);
            }
    }
    cout << sz(st) << '\n';
    return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

#define fab(i,a,b) for (int i=a; i<=b; i++)
#define rep(i,n) fab(i,0,n-1)
#define sz(x) int(x.size())

int risposta = 0;
string s, a, b;

class Nodo
{
    public:
    Nodo* child[26];
    bool ends;
    Nodo() : ends(false) {
        rep(i, 26) child[i] = NULL;
    }
} *root;

Nodo* insert(int a, int b, Nodo* r)
{
    int i;
    for(i = a; i <= b; i ++)
        if (r->child[s[i]-'a'] != NULL)
            r = r->child[s[i]-'a'];
        else
            break;
    for ( ; i <= b; i ++) {
        r = r->child[s[i]-'a'] = new Nodo();
    }
    if (!r->ends) risposta++;
    r->ends = true;
    return r;
}

vector<int> pre, suf;

int main()
{
   // freopen("input.txt", "r", stdin);

    root = new Nodo();
    cin >> s >> a >> b;

    rep(i, sz(s)) {
        int j = 0;
        while (j < sz(a) && a[j] == s[i+j]) j++;
        if (j == sz(a)) pre.push_back(i);
    }

    rep(i, sz(s)) {
        int j = sz(b)-1;
        while (j >= 0 && b[j] == s[i+j]) j--;
        if (j == -1) suf.push_back(i);
    }

    //rep(i, sz(pre)) cout << pre[i] << ' '; cout << '\n'; rep(i, sz(suf)) cout << suf[i] << ' '; cout << '\n';

    rep(i, sz(pre)) {
        Nodo *p = root;
        int last = pre[i];
        rep(j, sz(suf)) {
			if (pre[i] <= suf[j] && pre[i]+sz(a) <= suf[j]+sz(b)) {
				p = insert(last, suf[j], p);
				last = suf[j]+1;
			}
		}
    }

    cout << risposta << '\n';
    return 0;
}


#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <cassert>
#include <ctime>

#include <iostream>
#include <utility>
#include <algorithm>

#include <vector>
#include <string>
#include <set>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <bitset>
#include <stack>

#define mp make_pair
#define pb push_back
#define fs first
#define sc second
#define sz(x) ((int)((x).size()))
#define all(x) ((x).begin()),((x).end())
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define forn(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)

using namespace std;

const double eps = 1e-10, inf = 1e10;
typedef long long ll;

char a[2100], b[2100], c[2100];
int indc[2100], indb[2100], la, lb, lc;

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("in","r",stdin);
    #endif

    scanf("%s\n%s\n%s\n", a+1, b+1, c+1);
    la = strlen(a+1);
    lb = strlen(b+1);
    lc = strlen(c+1);
    indb[1]=0;
    int k=0, q;
    for (q=2; q<=lb; q++)
    {
        while (k>0 && b[k+1]!=b[q]) k=indb[k];
        if (b[k+1]==b[q]) k++;
        indb[q]=k;
    }
    q=k=0;
    indc[1]=0;
    for (q=2; q<=lb; q++)
    {
        while (k>0 && c[k+1]!=c[q]) k=indc[k];
        if (c[k+1]==c[q]) k++;
        indc[q]=k;
    }
    vector<int> matchb, matchc;
    q=0;
    forn(i, 1, la)
    {
        while (q>0 && b[q+1]!=a[i]) q=indb[q];
        if (b[q+1]==a[i]) q++;
        if (q==lb)
        {
            matchb.pb(i-lb+1);
            q=indb[q];
        }
    }
    q=0;
    forn(i, 1, la)
    {
        while (q>0 && c[q+1]!=a[i]) q=indc[q];
        if (c[q+1]==a[i]) q++;
        if (q==lc)
        {
            matchc.pb(i);
            q=indc[q];
        }
    }
    /*rep(i, sz(matchb)) cout << matchb[i] << ' ';
    cout << '\n';
    rep(i, sz(matchc)) cout << matchc[i] << ' ';
    cout << '\n';*/

    set<string> st;
    int ans=0; string tmp;
    rep(i, sz(matchb))
    {
        rep(j, sz(matchc))
            if (matchc[j] >= matchb[i])
            {
                tmp = "";
                for (int k=matchb[i]; k<=matchc[j]; k++) tmp += a[k];
                st.insert(tmp);
            }
    }
    cout << sz(st) << '\n';
    return 0;
}


//In the name of God
#include <algorithm>
#include <iostream>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>

#define X first
#define Y second
//#define X imag()
//#define Y real()
//#define cin fin
//#define cout fout
#define err(x) cerr << #x << ' ' << x << endl ;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef complex<ld> point;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;

const ll maxn = 2 * 1e3 + 10;
const ll P = 1e9 + 7;
const ll B = 29;

ll h[maxn][maxn], beg[maxn], en[maxn];
string t, b, e;
//vector<ll> bmatch, ematch;
set<ll> ans;

inline void init ()
{
  cin >> t >> b >> e ;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, e.size()) == e)
      en[i + e.size() - 1] = 1;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, b.size()) == b)
      beg[i] = 1;
  for(int i = 0 ; i < t.size() ; i++)
    for(int j = i + 1 ; j <= t.size() ; j++)
      h[i][j] = (h[i][j - 1] * B + t[i] - 'a' + 1) % P;
}
/*
inline ll hash (int fi, int se)
{
  if(fi > se)
    return -1;
  ll a = h[fi], b = h[se];
  return (ll) (z[se - fi] * a - h[se] + P) % P;
}
*/
inline void solve ()
{
  for(int i = max(e.size(), b.size()) ; i <= t.size() ; i++)
    for(int j = i + 1 ; j + i <= t.size() ; j++)
      if(beg[j] && en[j + i - 1])
	ans.insert(h[j][j + i - 1]);
}

int main ()
{
  ios :: sync_with_stdio(0);
  init();
  solve();
  ans.insert(-1);
  ans.erase(-1);
  cout << ans.size() << endl ;
}


//In the name of God
#include <algorithm>
#include <iostream>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>

#define X first
#define Y second
//#define X imag()
//#define Y real()
//#define cin fin
//#define cout fout
#define err(x) cerr << #x << ' ' << x << endl ;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef complex<ld> point;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;

const ll maxn = 5 * 1e3 + 10;
const ll P = 1e9 + 7;
const ll B = 29;

ll h[maxn][maxn], z[maxn], beg[maxn], en[maxn];
string t, b, e;
//vector<ll> bmatch, ematch;
set<ll> ans;

inline void init ()
{
  cin >> t >> b >> e ;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, e.size()) == e)
      en[i + e.size()] = 1;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, b.size()) == b)
      beg[i] = 1;
  z[0] = 1;
  for(int i = 0 ; i < t.size() ; i++)
    for(int j = i + 1 ; j < t.size() ; j++)
      h[i][j] = (h[i][j - 1] * B + t[i] - 'a' + 1) % P;
}
/*
inline ll hash (int fi, int se)
{
  if(fi > se)
    return -1;
  ll a = h[fi], b = h[se];
  return (ll) (z[se - fi] * a - h[se] + P) % P;
}
*/
inline void solve ()
{
  for(int i = max(e.size(), b.size()) ; i < t.size() ; i++)
    for(int j = 0 ; j + i <= t.size() ; j++)
      if(beg[j] && en[j + i - 1])
	ans.insert(h[j][j + i - 1]);
}

int main ()
{
  ios :: sync_with_stdio(0);
  init();
  solve();
  ans.insert(-1);
  ans.erase(-1);
  cout << ans.size() << endl ;
}


//In the name of God
#include <algorithm>
#include <iostream>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>

#define X first
#define Y second
//#define X imag()
//#define Y real()
//#define cin fin
//#define cout fout
#define err(x) cerr << #x << ' ' << x << endl ;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef complex<ld> point;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;

const ll maxn = 2 * 1e3 + 10;
const ll P = 1e9 + 7;
const ll B = 33;

ll h[maxn], z[maxn];
string t, b, e;
vector<ll> bmatch, ematch;
set<ll> ans;

inline void printinfo ()
{
  cerr << "***********************************" << endl ;
  cerr << "bmatch" << endl ;
  for(int i = 0 ; i < bmatch.size() ; i++)
    cerr << bmatch[i] << ' ' ;
  cerr << endl ;
  cerr << "ematch" << endl ;
  for(int i = 0 ; i < ematch.size() ; i++)
    cerr << ematch[i] << ' ' ;
  cerr << endl ;
  cerr << "***********************************" << endl ;
}

inline void init ()
{
  cin >> t >> b >> e ;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, e.size()) == e)
      {
	ematch.push_back((ll)i);
	printinfo();
      }
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, b.size()) == b)
      {
	bmatch.push_back((ll)i);
	printinfo();
      }
  z[0] = 1;
  for(int i = 1 ; i < maxn ; i++)
    {
      b[i] = (b[i - 1] * B + t[i - 1] - 'a' + 1) % P;
      z[i] = (z[i - 1] * B) % P;
    }
}

inline ll hash (int fi, int se)
{
  if(fi > se)
    return -1;
  ll a = h[fi], b = h[se];
  return (ll) (z[se - fi] * a - h[se] + P) % P;
}

inline void solve ()
{
  for(int i = 0 ; i < ematch.size() ; i++)
    {
      cerr << i << ' '  ;
      int se = ematch[i];
      for(int j = 0 ; j < bmatch.size() && bmatch[j] < se ; j++, cerr << "to hash, ")
	  ans.insert(hash(bmatch[j], ematch[i]));
    }
}

int main ()
{
  ios :: sync_with_stdio(0);
  //  init();
    cin >> t >> b >> e ;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, e.size()) == e)
      {
	ematch.push_back((ll)i);
	printinfo();
      }
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, b.size()) == b)
      {
	bmatch.push_back((ll)i);
	printinfo();
      }
  cerr << "this " << endl ;printinfo();
  z[0] = 1;
  for(int i = 1 ; i < maxn ; i++)
    {
      h[i] = (h[i - 1] * B + t[i - 1] - 'a' + 1) % P;
      z[i] = (z[i - 1] * B) % P;
    }
  cerr << "here" << endl ; printinfo();
  //  solve();
  for(int i = 0 ; i < ematch.size() ; i++)
    {
      cerr << i << ' '  ;
      for(int j = 0 ; j < bmatch.size() && bmatch[j] < ematch[i] ; j++, cerr << "to hash, ")
	  ans.insert(hash(bmatch[j], ematch[i]));
    }
  printinfo();
  cerr << "HERE" << endl ;
  ans.insert(-1);
  ans.erase(-1);
  cout << ans.size() << endl ;
}


//In the name of God
#include <algorithm>
#include <iostream>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>

#define X first
#define Y second
//#define X imag()
//#define Y real()
//#define cin fin
//#define cout fout
#define err(x) cerr << #x << ' ' << x << endl ;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef complex<ld> point;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;

const ll maxn = 2 * 1e3 + 10;
const ll P = 1234567891011;
const ll B = 35;

ll h[maxn][maxn], beg[maxn], en[maxn];
string t, b, e;
//vector<ll> bmatch, ematch;
set<ll> ans;

inline void init ()
{
  cin >> t >> b >> e ;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, e.size()) == e)
      en[i + e.size() - 1] = 1;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, b.size()) == b)
      beg[i] = 1;
  for(int i = 0 ; i < t.size() ; i++)
    for(int j = i + 1 ; j < t.size() ; j++)
      h[i][j] = (h[i][j - 1] * B + t[j] - 'a' + 1) % P;
}
/*
inline ll hash (int fi, int se)
{
  if(fi > se)
    return -1;
  ll a = h[fi], b = h[se];
  return (ll) (z[se - fi] * a - h[se] + P) % P;
}
*/
inline void solve ()
{
  for(int i = max(e.size(), b.size()) ; i <= t.size() ; i++)
    for(int j = 0 ; j + i <= t.size() ; j++)
      if(beg[j] && en[j + i - 1])
	ans.insert(h[j][j + i - 1]);
}

int main ()
{
  ios :: sync_with_stdio(0);
  init();
  solve();
  ans.insert(-1);
  ans.erase(-1);
  cout << ans.size() << endl ;
}


//In the name of God
#include <algorithm>
#include <iostream>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>

#define X first
#define Y second
//#define X imag()
//#define Y real()
//#define cin fin
//#define cout fout
#define err(x) cerr << #x << ' ' << x << endl ;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef complex<ld> point;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;

const ll maxn = 2 * 1e3 + 10;
const ll P = 1e9 + 7;
const ll B = 29;

ll h[maxn][maxn], beg[maxn], en[maxn];
string t, b, e;
//vector<ll> bmatch, ematch;
set<ll> ans;

inline void init ()
{
  cin >> t >> b >> e ;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, e.size()) == e)
      en[i + e.size() - 1] = 1;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, b.size()) == b)
      beg[i] = 1;
  for(int i = 0 ; i < t.size() ; i++)
    for(int j = i + 1 ; j <= t.size() ; j++)
      h[i][j] = (h[i][j - 1] * B + t[i] - 'a' + 1) % P;
}
/*
inline ll hash (int fi, int se)
{
  if(fi > se)
    return -1;
  ll a = h[fi], b = h[se];
  return (ll) (z[se - fi] * a - h[se] + P) % P;
}
*/
inline void solve ()
{
  for(int i = max(e.size(), b.size()) ; i <= t.size() ; i++)
    for(int j = 0 ; j + i <= t.size() ; j++)
      if(beg[j] && en[j + i - 1])
	ans.insert(h[j][j + i]);
}

int main ()
{
  ios :: sync_with_stdio(0);
  init();
  solve();
  ans.insert(-1);
  ans.erase(-1);
  cout << ans.size() << endl ;
}


//In the name of God
#include <algorithm>
#include <iostream>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>

#define X first
#define Y second
//#define X imag()
//#define Y real()
//#define cin fin
//#define cout fout
#define err(x) cerr << #x << ' ' << x << endl ;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef complex<ld> point;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;

const ll maxn = 2 * 1e3 + 10;
const ll P = 1e9 + 7;
const ll B = 33;

ll h[maxn], z[maxn];
string t, b, e;
vector<ll> bmatch, ematch;
set<ll> ans;

inline void printinfo ()
{
  cerr << "***********************************" << endl ;
  cerr << "bmatch" << endl ;
  for(int i = 0 ; i < bmatch.size() ; i++)
    cerr << bmatch[i] << ' ' ;
  cerr << endl ;
  cerr << "ematch" << endl ;
  for(int i = 0 ; i < ematch.size() ; i++)
    cerr << ematch[i] << ' ' ;
  cerr << endl ;
  cerr << "***********************************" << endl ;
}

inline void init ()
{
  cin >> t >> b >> e ;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, e.size()) == e)
      ematch.push_back((ll)i + e.size());
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, b.size()) == b)
      bmatch.push_back((ll)i + b.size());
  z[0] = 1;
  for(int i = 1 ; i < maxn ; i++)
    {
      h[i] = (h[i - 1] * B + t[i - 1] - 'a' + 1) % P;
      z[i] = (z[i - 1] * B) % P;
    }
}

inline ll hash (int fi, int se)
{
  if(fi > se)
    return -1;
  ll a = h[fi], b = h[se];
  return (ll) (z[se - fi] * a - h[se] + P) % P;
}

inline void solve ()
{
  for(int i = 0 ; i < ematch.size() ; i++)
    for(int j = 0 ; j < bmatch.size() && bmatch[j] <= ematch[i] ; j++)
      ans.insert(hash(bmatch[j], ematch[i]));
}

int main ()
{
  ios :: sync_with_stdio(0);
  init();
  solve();
  ans.insert(-1);
  ans.erase(-1);
  cout << ans.size() << endl ;
}


//In the name of God
#include <algorithm>
#include <iostream>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>

#define X first
#define Y second
//#define X imag()
//#define Y real()
//#define cin fin
//#define cout fout
#define err(x) cerr << #x << ' ' << x << endl ;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef complex<ld> point;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;

const ll maxn = 2 * 1e3 + 10;
const ll P = 1234567891011;
const ll B = 35;

ll h[maxn][maxn], beg[maxn], en[maxn];
string t, b, e;
//vector<ll> bmatch, ematch;
vector<ll> ans;

inline void init ()
{
  cin >> t >> b >> e ;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, e.size()) == e)
      en[i + e.size() - 1] = 1;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, b.size()) == b)
      beg[i] = 1;
  for(int i = 0 ; i < t.size() ; i++)
    for(int j = i + 1 ; j < t.size() ; j++)
      h[i][j] = (h[i][j - 1] * B + t[j] - 'a' + 1) % P;
}
/*
inline ll hash (int fi, int se)
{
  if(fi > se)
    return -1;
  ll a = h[fi], b = h[se];
  return (ll) (z[se - fi] * a - h[se] + P) % P;
}
*/
inline void solve ()
{
  for(int i = max(e.size(), b.size()) ; i <= t.size() ; i++)
    for(int j = 0 ; j + i <= t.size() ; j++)
      if(beg[j] && en[j + i - 1])
	ans.push_back(h[j][j + i - 1]);
}

int main ()
{
  ios :: sync_with_stdio(0);
  init();
  solve();
  sort(ans.begin(), ans.end());
  cout << unique(ans.begin(), ans.end()) - ans.begin() << endl ;
}


//In the name of God
#include <algorithm>
#include <iostream>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>

#define X first
#define Y second
//#define X imag()
//#define Y real()
//#define cin fin
//#define cout fout
#define err(x) cerr << #x << ' ' << x << endl ;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef complex<ld> point;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;

const ll maxn = 2 * 1e3 + 10;
const ll P = 1e9 + 7;
const ll B = 33;

ll h[maxn], z[maxn];
string t, b, e;
vector<ll> bmatch, ematch;
set<ll> ans;

inline void printinfo ()
{
  cerr << "***********************************" << endl ;
  cerr << "bmatch" << endl ;
  for(int i = 0 ; i < bmatch.size() ; i++)
    cerr << bmatch[i] << ' ' ;
  cerr << endl ;
  cerr << "ematch" << endl ;
  for(int i = 0 ; i < ematch.size() ; i++)
    cerr << ematch[i] << ' ' ;
  cerr << endl ;
  cerr << "***********************************" << endl ;
}

inline void init ()
{
  cin >> t >> b >> e ;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, e.size()) == e)
      ematch.push_back((ll)i + e.size());
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, b.size()) == b)
      bmatch.push_back((ll)i + b.size());
  z[0] = 1;
  for(int i = 1 ; i < maxn ; i++)
    {
      h[i] = (h[i - 1] * B + t[i - 1] - 'a' + 1) % P;
      z[i] = (z[i - 1] * B) % P;
    }
}

inline ll hash (int fi, int se)
{
  if(fi > se)
    return -1;
  ll a = h[fi], b = h[se];
  return (ll) (z[se - fi] * a - h[se] + P) % P;
}

inline void solve ()
{
  for(int i = 0 ; i < ematch.size() ; i++)
    for(int j = 0 ; j < bmatch.size() && bmatch[j] <= ematch[i] ; j++)
      ans.insert(hash(min(bmatch[j] - b.size(), ematch[i] - e.size()), ematch[i]));
}

int main ()
{
  ios :: sync_with_stdio(0);
  init();
  solve();
  ans.insert(-1);
  ans.erase(-1);
  cout << ans.size() << endl ;
}


//In the name of God
#include <algorithm>
#include <iostream>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>

#define X first
#define Y second
//#define X imag()
//#define Y real()
//#define cin fin
//#define cout fout
#define err(x) cerr << #x << ' ' << x << endl ;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef complex<ld> point;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;

const ll maxn = 5 * 1e3 + 10;
const ll P = 1e9 + 7;
const ll B = 33;

ll h[maxn], z[maxn];
string t, b, e;
vector<ll> bmatch, ematch;
set<ll> ans;

inline void printinfo ()
{
  cerr << "***********************************" << endl ;
  cerr << "bmatch" << endl ;
  for(int i = 0 ; i < bmatch.size() ; i++)
    cerr << bmatch[i] << ' ' ;
  cerr << endl ;
  cerr << "ematch" << endl ;
  for(int i = 0 ; i < ematch.size() ; i++)
    cerr << ematch[i] << ' ' ;
  cerr << endl ;
  cerr << "***********************************" << endl ;
}

inline void init ()
{
  cin >> t >> b >> e ;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, e.size()) == e)
      ematch.push_back((ll)i + e.size());
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, b.size()) == b)
      bmatch.push_back((ll)i + b.size());
  z[0] = 1;
  for(int i = 1 ; i < maxn ; i++)
    {
      h[i] = (h[i - 1] * B + t[i - 1] - 'a' + 1) % P;
      z[i] = (z[i - 1] * B) % P;
    }
}

inline ll hash (int fi, int se)
{
  if(fi > se)
    return -1;
  ll a = h[fi], b = h[se];
  return (ll) (z[se - fi] * a - h[se] + P) % P;
}

inline void solve ()
{
  for(int i = 0 ; i < ematch.size() ; i++)
    for(int j = 0 ; j < bmatch.size() && bmatch[j] <= ematch[i] ; j++)
      if(bmatch[j] - b.size() <= ematch[i] - e.size())
	ans.insert(hash(bmatch[j] - b.size(), ematch[i]));
}

int main ()
{
  ios :: sync_with_stdio(0);
  init();
  solve();
  ans.insert(-1);
  ans.erase(-1);
  cout << ans.size() << endl ;
}


//In the name of God
#include <algorithm>
#include <iostream>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>

#define X first
#define Y second
//#define X imag()
//#define Y real()
//#define cin fin
//#define cout fout
#define err(x) cerr << #x << ' ' << x << endl ;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef complex<ld> point;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;

const ll maxn = 2 * 1e3 + 10;
const ll P = 1e9 + 7;
const ll B = 33;

ll h[maxn], z[maxn];
string t, b, e;
vector<ll> bmatch, ematch;
set<ll> ans;

inline void printinfo ()
{
  cerr << "***********************************" << endl ;
  cerr << "bmatch" << endl ;
  for(int i = 0 ; i < bmatch.size() ; i++)
    cerr << bmatch[i] << ' ' ;
  cerr << endl ;
  cerr << "ematch" << endl ;
  for(int i = 0 ; i < ematch.size() ; i++)
    cerr << ematch[i] << ' ' ;
  cerr << endl ;
  cerr << "***********************************" << endl ;
}

inline void init ()
{
  cin >> t >> b >> e ;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, e.size()) == e)
      ematch.push_back((ll)i + e.size());
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, b.size()) == b)
      bmatch.push_back((ll)i + b.size());
  z[0] = 1;
  for(int i = 1 ; i < maxn ; i++)
    {
      h[i] = (h[i - 1] * B + t[i - 1] - 'a' + 1) % P;
      z[i] = (z[i - 1] * B) % P;
    }
}

inline ll hash (int fi, int se)
{
  if(fi > se)
    return -1;
  ll a = h[fi], b = h[se];
  return (ll) (z[se - fi] * a - h[se] + P) % P;
}

inline void solve ()
{
  for(int i = 0 ; i < ematch.size() ; i++)
    for(int j = 0 ; j < bmatch.size() && bmatch[j] <= ematch[i] ; j++)
      if(bmatch[j] - b.size() <= ematch[i] - e.size())
	ans.insert(hash(bmatch[j] - b.size(), ematch[i]));
}

int main ()
{
  ios :: sync_with_stdio(0);
  init();
  solve();
  ans.insert(-1);
  ans.erase(-1);
  cout << ans.size() << endl ;
}


//In the name of God
#include <algorithm>
#include <iostream>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>

#define X first
#define Y second
//#define X imag()
//#define Y real()
//#define cin fin
//#define cout fout
#define err(x) cerr << #x << ' ' << x << endl ;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef complex<ld> point;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;

const ll maxn = 2 * 1e3 + 10;
const ll P = 12345678910111213;
const ll B = 35;

ll h[maxn][maxn], beg[maxn], en[maxn];
string t, b, e;
//vector<ll> bmatch, ematch;
vector<ll> ans;

inline void init ()
{
  cin >> t >> b >> e ;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, e.size()) == e)
      en[i + e.size() - 1] = 1;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, b.size()) == b)
      beg[i] = 1;
  for(int i = 0 ; i < t.size() ; i++)
    for(int j = i + 1 ; j < t.size() ; j++)
      h[i][j] = (h[i][j - 1] * B + t[j] - 'a' + 1) % P;
}
/*
inline ll hash (int fi, int se)
{
  if(fi > se)
    return -1;
  ll a = h[fi], b = h[se];
  return (ll) (z[se - fi] * a - h[se] + P) % P;
}
*/
inline void solve ()
{
  for(int i = max(e.size(), b.size()) ; i <= t.size() ; i++)
    for(int j = 0 ; j + i <= t.size() ; j++)
      if(beg[j] && en[j + i - 1])
	ans.push_back(h[j][j + i - 1]);
}

int main ()
{
  ios :: sync_with_stdio(0);
  init();
  solve();
  sort(ans.begin(), ans.end());
  cout << unique(ans.begin(), ans.end()) - ans.begin() << endl ;
}


//In the name of God
#include <algorithm>
#include <iostream>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>

#define X first
#define Y second
//#define X imag()
//#define Y real()
//#define cin fin
//#define cout fout
#define err(x) cerr << #x << ' ' << x << endl ;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef complex<ld> point;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;

const ll maxn = 5 * 1e3 + 10;
const ll P = 1e9 + 7;
const ll B = 29;

ll h[maxn][maxn], z[maxn];
string t, b, e;
vector<ll> bmatch, ematch;
set<ll> ans;

inline void printinfo ()
{
  cerr << "***********************************" << endl ;
  cerr << "bmatch" << endl ;
  for(int i = 0 ; i < bmatch.size() ; i++)
    cerr << bmatch[i] << ' ' ;
  cerr << endl ;
  cerr << "ematch" << endl ;
  for(int i = 0 ; i < ematch.size() ; i++)
    cerr << ematch[i] << ' ' ;
  cerr << endl ;
  cerr << "***********************************" << endl ;
}

inline void init ()
{
  cin >> t >> b >> e ;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, e.size()) == e)
      ematch.push_back((ll)i + e.size());
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, b.size()) == b)
      bmatch.push_back((ll)i + b.size());
  z[0] = 1;
  for(int i = 0 ; i < t.size() ; i++)
    for(int j = i + 1 ; j < t.size() ; j++)
      h[i][j] = (h[i][j - 1] * B + t[i] - 'a' + 1) % P;
}
/*
inline ll hash (int fi, int se)
{
  if(fi > se)
    return -1;
  ll a = h[fi], b = h[se];
  return (ll) (z[se - fi] * a - h[se] + P) % P;
}
*/
inline void solve ()
{
  for(int i = 0 ; i < ematch.size() ; i++)
    for(int j = 0 ; j < bmatch.size() && bmatch[j] <= ematch[i] ; j++)
      if(bmatch[j] - b.size() <= ematch[i] - e.size())
	ans.insert(h[bmatch[j] - b.size()][ematch[i]]);
}

int main ()
{
  ios :: sync_with_stdio(0);
  init();
  solve();
  ans.insert(-1);
  ans.erase(-1);
  cout << ans.size() << endl ;
}


//In the name of God
#include <algorithm>
#include <iostream>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>

#define X first
#define Y second
//#define X imag()
//#define Y real()
//#define cin fin
//#define cout fout
#define err(x) cerr << #x << ' ' << x << endl ;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef complex<ld> point;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;

const ll maxn = 2 * 1e3 + 10;
const ll P = 1234567891011;
const ll B = 35;

ll h[maxn][maxn], beg[maxn], en[maxn];
string t, b, e;
//vector<ll> bmatch, ematch;
set<ll> ans;

inline void init ()
{
  cin >> t >> b >> e ;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, e.size()) == e)
      en[i + e.size() - 1] = 1;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, b.size()) == b)
      beg[i] = 1;
  for(int i = 0 ; i < t.size() ; i++)
    for(int j = i + 1 ; j < t.size() ; j++)
      h[i][j] = (h[i][j - 1] * B + t[j] - 'a' + 1) % P;
}
/*
inline ll hash (int fi, int se)
{
  if(fi > se)
    return -1;
  ll a = h[fi], b = h[se];
  return (ll) (z[se - fi] * a - h[se] + P) % P;
}
*/
inline void solve ()
{
  for(int i = max(e.size(), b.size()) ; i <= t.size() ; i++)
    for(int j = 0 ; j + i <= t.size() ; j++)
      if(beg[j] && en[j + i - 1])
	ans.insert(h[j][j + i]);
}

int main ()
{
  ios :: sync_with_stdio(0);
  init();
  solve();
  ans.insert(-1);
  ans.erase(-1);
  cout << ans.size() << endl ;
}


//In the name of God
#include <algorithm>
#include <iostream>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>

#define X first
#define Y second
//#define X imag()
//#define Y real()
//#define cin fin
//#define cout fout
#define err(x) cerr << #x << ' ' << x << endl ;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef complex<ld> point;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;

const ll maxn = 5 * 1e3 + 10;
const ll P = 1e9 + 7;
const ll B = 29;

ll h[maxn], z[maxn];
string t, b, e;
vector<ll> bmatch, ematch;
set<ll> ans;

inline void printinfo ()
{
  cerr << "***********************************" << endl ;
  cerr << "bmatch" << endl ;
  for(int i = 0 ; i < bmatch.size() ; i++)
    cerr << bmatch[i] << ' ' ;
  cerr << endl ;
  cerr << "ematch" << endl ;
  for(int i = 0 ; i < ematch.size() ; i++)
    cerr << ematch[i] << ' ' ;
  cerr << endl ;
  cerr << "***********************************" << endl ;
}

inline void init ()
{
  cin >> t >> b >> e ;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, e.size()) == e)
      ematch.push_back((ll)i + e.size());
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, b.size()) == b)
      bmatch.push_back((ll)i + b.size());
  z[0] = 1;
  for(int i = 1 ; i <= t.size() ; i++)
    {
      h[i] = (h[i - 1] * B + t[i - 1] - 'a' + 1) % P;
      z[i] = (z[i - 1] * B) % P;
    }
}

inline ll hash (int fi, int se)
{
  if(fi > se)
    return -1;
  ll a = h[fi], b = h[se];
  return (ll) (z[se - fi] * a - h[se] + P) % P;
}

inline void solve ()
{
  for(int i = 0 ; i < ematch.size() ; i++)
    for(int j = 0 ; j < bmatch.size() && bmatch[j] <= ematch[i] ; j++)
      if(bmatch[j] - b.size() <= ematch[i] - e.size())
	ans.insert(hash(bmatch[j] - b.size(), ematch[i]));
}

int main ()
{
  ios :: sync_with_stdio(0);
  init();
  solve();
  ans.insert(-1);
  ans.erase(-1);
  cout << ans.size() << endl ;
}


//In the name of God
#include <algorithm>
#include <iostream>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>

#define X first
#define Y second
//#define X imag()
//#define Y real()
//#define cin fin
//#define cout fout
#define err(x) cerr << #x << ' ' << x << endl ;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef complex<ld> point;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;

const ll maxn = 2 * 1e3 + 10;
const ll P = 1e9 + 7;
const ll B = 33;

ll h[maxn], z[maxn];
string t, b, e;
vector<ll> bmatch, ematch;
set<ll> ans;

inline void printinfo ()
{
  cerr << "***********************************" << endl ;
  cerr << "bmatch" << endl ;
  for(int i = 0 ; i < bmatch.size() ; i++)
    cerr << bmatch[i] << ' ' ;
  cerr << endl ;
  cerr << "ematch" << endl ;
  for(int i = 0 ; i < ematch.size() ; i++)
    cerr << ematch[i] << ' ' ;
  cerr << endl ;
  cerr << "***********************************" << endl ;
}

inline void init ()
{
  cin >> t >> b >> e ;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, e.size()) == e)
	ematch.push_back((ll)i);
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, b.size()) == b)
      bmatch.push_back((ll)i);
  z[0] = 1;
  for(int i = 1 ; i < maxn ; i++)
    {
      h[i] = (h[i - 1] * B + t[i - 1] - 'a' + 1) % P;
      z[i] = (z[i - 1] * B) % P;
    }
}

inline ll hash (int fi, int se)
{
  if(fi > se)
    return -1;
  ll a = h[fi], b = h[se];
  return (ll) (z[se - fi] * a - h[se] + P) % P;
}

inline void solve ()
{
  for(int i = 0 ; i < ematch.size() ; i++)
    for(int j = 0 ; j < bmatch.size() && bmatch[j] <= ematch[i] ; j++)
      ans.insert(hash(bmatch[j], ematch[i]));
}

int main ()
{
  ios :: sync_with_stdio(0);
  init();
  solve();
  ans.insert(-1);
  ans.erase(-1);
  cout << ans.size() << endl ;
}


//In the name of God
#include <algorithm>
#include <iostream>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>

#define X first
#define Y second
//#define X imag()
//#define Y real()
//#define cin fin
//#define cout fout
#define err(x) cerr << #x << ' ' << x << endl ;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef complex<ld> point;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;

const ll maxn = 5 * 1e3 + 10;
const ll P = 1e9 + 7;
const ll B = 33;

ll h[maxn], z[maxn];
string t, b, e;
vector<ll> bmatch, ematch;
set<ll> ans;

inline void printinfo ()
{
  cerr << "***********************************" << endl ;
  cerr << "bmatch" << endl ;
  for(int i = 0 ; i < bmatch.size() ; i++)
    cerr << bmatch[i] << ' ' ;
  cerr << endl ;
  cerr << "ematch" << endl ;
  for(int i = 0 ; i < ematch.size() ; i++)
    cerr << ematch[i] << ' ' ;
  cerr << endl ;
  cerr << "***********************************" << endl ;
}

inline void init ()
{
  cin >> t >> b >> e ;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, e.size()) == e)
      ematch.push_back((ll)i + e.size());
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, b.size()) == b)
      bmatch.push_back((ll)i + b.size());
  z[0] = 1;
  for(int i = 1 ; i <= t.size() ; i++)
    {
      h[i] = (h[i - 1] * B + t[i - 1] - 'a' + 1) % P;
      z[i] = (z[i - 1] * B) % P;
    }
}

inline ll hash (int fi, int se)
{
  if(fi > se)
    return -1;
  ll a = h[fi], b = h[se];
  return (ll) (-(z[se - fi] * a) - h[fi] + P) % P;
}

inline void solve ()
{
  for(int i = 0 ; i < ematch.size() ; i++)
    for(int j = 0 ; j < bmatch.size() && bmatch[j] <= ematch[i] ; j++)
      if(bmatch[j] - b.size() <= ematch[i] - e.size())
	ans.insert(hash(bmatch[j] - b.size(), ematch[i]));
}

int main ()
{
  ios :: sync_with_stdio(0);
  init();
  solve();
  ans.insert(-1);
  ans.erase(-1);
  cout << ans.size() << endl ;
}


//In the name of God
#include <algorithm>
#include <iostream>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>

#define X first
#define Y second
//#define X imag()
//#define Y real()
//#define cin fin
//#define cout fout
#define err(x) cerr << #x << ' ' << x << endl ;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef complex<ld> point;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;

const ll maxn = 5 * 1e3 + 10;
const ll P = 1e9 + 7;
const ll B = 33;

ll h[maxn], z[maxn];
string t, b, e;
vector<ll> bmatch, ematch;
set<ll> ans;

inline void printinfo ()
{
  cerr << "***********************************" << endl ;
  cerr << "bmatch" << endl ;
  for(int i = 0 ; i < bmatch.size() ; i++)
    cerr << bmatch[i] << ' ' ;
  cerr << endl ;
  cerr << "ematch" << endl ;
  for(int i = 0 ; i < ematch.size() ; i++)
    cerr << ematch[i] << ' ' ;
  cerr << endl ;
  cerr << "***********************************" << endl ;
}

inline void init ()
{
  cin >> t >> b >> e ;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, e.size()) == e)
      ematch.push_back((ll)i + e.size());
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, b.size()) == b)
      bmatch.push_back((ll)i + b.size());
  z[0] = 1;
  for(int i = 1 ; i <= t.size() ; i++)
    {
      h[i] = (h[i - 1] * B + t[i - 1] - 'a' + 1) % P;
      z[i] = (z[i - 1] * B) % P;
    }
}

inline ll hash (int fi, int se)
{
  if(fi > se)
    return -1;
  ll a = h[fi], b = h[se];
  return (ll) (z[se - fi] * a - h[se] + P) % P;
}

inline void solve ()
{
  for(int i = 0 ; i < ematch.size() ; i++)
    for(int j = 0 ; j < bmatch.size() && bmatch[j] <= ematch[i] ; j++)
      if(bmatch[j] - b.size() <= ematch[i] - e.size())
	ans.insert(hash(bmatch[j] - b.size(), ematch[i]));
}

int main ()
{
  ios :: sync_with_stdio(0);
  init();
  solve();
  ans.insert(-1);
  ans.erase(-1);
  cout << ans.size() << endl ;
}


//In the name of God
#include <algorithm>
#include <iostream>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>

#define X first
#define Y second
//#define X imag()
//#define Y real()
//#define cin fin
//#define cout fout
#define err(x) cerr << #x << ' ' << x << endl ;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef complex<ld> point;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;

const ll maxn = 5 * 1e3 + 10;
const ll P = 1e9 + 7;
const ll B = 29;

ll h[maxn][maxn], z[maxn], beg[maxn], en[maxn];
string t, b, e;
//vector<ll> bmatch, ematch;
set<ll> ans;

inline void init ()
{
  cin >> t >> b >> e ;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, e.size()) == e)
      en[i + e.size() - 1] = 1;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, b.size()) == b)
      beg[i] = 1;
  z[0] = 1;
  for(int i = 0 ; i < t.size() ; i++)
    for(int j = i + 1 ; j < t.size() ; j++)
      h[i][j] = (h[i][j - 1] * B + t[i] - 'a' + 1) % P;
}
/*
inline ll hash (int fi, int se)
{
  if(fi > se)
    return -1;
  ll a = h[fi], b = h[se];
  return (ll) (z[se - fi] * a - h[se] + P) % P;
}
*/
inline void solve ()
{
  for(int i = max(e.size(), b.size()) ; i <= t.size() ; i++)
    for(int j = 0 ; j + i <= t.size() ; j++)
      if(beg[j] && en[j + i - 1])
	ans.insert(h[j][j + i - 1]);
}

int main ()
{
  ios :: sync_with_stdio(0);
  init();
  solve();
  ans.insert(-1);
  ans.erase(-1);
  cout << ans.size() << endl ;
}


//In the name of God
#include <algorithm>
#include <iostream>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>

#define X first
#define Y second
//#define X imag()
//#define Y real()
//#define cin fin
//#define cout fout
#define err(x) cerr << #x << ' ' << x << endl ;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef complex<ld> point;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;

const ll maxn = 2 * 1e3 + 10;
const ll P = 1e9 + 7;
const ll B = 29;

ll h[maxn][maxn], beg[maxn], en[maxn];
string t, b, e;
//vector<ll> bmatch, ematch;
set<ll> ans;

inline void init ()
{
  cin >> t >> b >> e ;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, e.size()) == e)
      en[i + e.size() - 1] = 1;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, b.size()) == b)
      beg[i] = 1;
  for(int i = 0 ; i < t.size() ; i++)
    for(int j = i + 1 ; j <= t.size() ; j++)
      h[i][j] = (h[i][j - 1] * B + t[i] - 'a' + 1) % P;
}
/*
inline ll hash (int fi, int se)
{
  if(fi > se)
    return -1;
  ll a = h[fi], b = h[se];
  return (ll) (z[se - fi] * a - h[se] + P) % P;
}
*/
inline void solve ()
{
  for(int i = max(e.size(), b.size()) ; i <= t.size() ; i++)
    for(int j = 0 ; j + i <= t.size() ; j++)
      if(beg[j] && en[j + i - 1])
	ans.insert(h[j][j + i - 1]);
}

int main ()
{
  ios :: sync_with_stdio(0);
  init();
  solve();
  ans.insert(-1);
  ans.erase(-1);
  cout << ans.size() << endl ;
}


//In the name of God
#include <algorithm>
#include <iostream>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>

#define X first
#define Y second
//#define X imag()
//#define Y real()
//#define cin fin
//#define cout fout
#define err(x) cerr << #x << ' ' << x << endl ;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef complex<ld> point;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;

const ll maxn = 2 * 1e3 + 10;
const ll P = 1e9 + 7;
const ll B = 29;

ll h[maxn][maxn], beg[maxn], en[maxn];
string t, b, e;
//vector<ll> bmatch, ematch;
set<ll> ans;

inline void init ()
{
  cin >> t >> b >> e ;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, e.size()) == e)
      en[i + e.size() - 1] = 1;
  for(int i = 0 ; i < t.size() ; i++)
    if(t.substr(i, b.size()) == b)
      beg[i] = 1;
  for(int i = 0 ; i < t.size() ; i++)
    for(int j = i + 1 ; j < t.size() ; j++)
      h[i][j] = (h[i][j - 1] * B + t[j] - 'a' + 1) % P;
}
/*
inline ll hash (int fi, int se)
{
  if(fi > se)
    return -1;
  ll a = h[fi], b = h[se];
  return (ll) (z[se - fi] * a - h[se] + P) % P;
}
*/
inline void solve ()
{
  for(int i = max(e.size(), b.size()) ; i <= t.size() ; i++)
    for(int j = 0 ; j + i <= t.size() ; j++)
      if(beg[j] && en[j + i - 1])
	ans.insert(h[j][j + i]);
}

int main ()
{
  ios :: sync_with_stdio(0);
  init();
  solve();
  ans.insert(-1);
  ans.erase(-1);
  cout << ans.size() << endl ;
}


#include <set>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>

using namespace std;

#define LL long long

char s[2010], b[2010], e[2010];
int ns, nb, ne, k;
LL p[2010], hs[2010], hb, he, H[3000005];

LL hash(int i, int j)
{
	LL h = hs[j];
	if (i) h -= hs[i-1];
	h *= p[ns-i-1];
	return h;
}

int main()
{
#ifndef ONLINE_JUDGE
 	freopen("input.txt", "r", stdin);
 	freopen("output.txt", "w", stdout);
#endif

	scanf("%s%s%s", s, b, e);

	ns = strlen(s);
	nb = strlen(b);
	ne = strlen(e);

	p[0] = 1;
	for (int i = 1; i < ns; ++i)
		p[i] = p[i-1] * 777711;

	for (int i = 0; i < ns; ++i)
	{
	 	hs[i] = (s[i]-'a'+1) * p[i];
	 	if (i) hs[i] += hs[i-1];
	}

	for (int i = 0; i < nb; ++i)
		hb += (b[i]-'a'+1) * p[i];

	for (int i = 0; i < ne; ++i)
		he += (e[i]-'a'+1) * p[i];

	hb *= p[ns-1];
	he *= p[ns-1];
	for (int l = max(nb, ne); l <= ns; ++l)
	{
		for (int i = 0; i+l-1 < ns; ++i)
			if (hash(i, i+nb-1) == hb && hash(i+l-ne, i+l-1) == he)
				H[k++] = hash(i, i+l-1);
	}
	int res = k > 0;
	for (int i = 1; i < k; ++i)
		if (H[i] != H[i-1]) ++res;
	printf("%d", res);

	return 0;
}


#include <cstdio>
#include <string>
#include <iostream>
#include <algorithm>

using namespace std;

#define dbg(...) fprintf(stderr, __VA_ARGS__)
#define LL long long

string text, begin, end;
LL hash[2005], hbegin, hend, p[2005];

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

 	cin >> text >> begin >> end;
	p[0] = 1;
	for (int i = 1; i < max(text.length(), max(begin.length(), end.length())); i++)
		p[i] = p[i-1] * 1000007;

	for (int i = 0; i < text.length(); i++) {
	 	hash[i] = (text[i]-'a' + 1) * p[i];
	 	if (i) hash[i] += hash[i-1];
	}

	for (int i = 0; i < begin.length(); i++)
		hbegin += (begin[i]-'a'+1)*p[i];
	for (int i = 0; i < end.length(); i++)
		hend += (end[i]-'a'+1)*p[i];

	hbegin *= p[(text.length()-1)-(begin.length()-1)];
	hend *= p[(text.length()-1)-(end.length()-1)];

	LL ans = 0;
	for (int i = 0; i+begin.length()-1 < text.length(); i++) {
	 	LL h1 = hash[i+begin.length()-1];
	 	if (i)
	 		h1 -= hash[i-1];
	 	h1 *= p[(text.length()-1)-(i+begin.length()-1)];
	 	if (h1 != hbegin) continue;
	 	for (int j = i; j+end.length()-1 < min(text.length(), i+begin.length()+1); j++) {
			LL h2 = hash[j+end.length()-1];
			if (j)
				h2 -= hash[j-1];
			h2 *= p[(text.length()-1)-(j+end.length()-1)];
			if (h2 == hend)
				++ans;
	 	}
	}
	cout << ans;

 	return 0;
}


#include <set>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>

using namespace std;

#define LL long long

char s[2010], b[2010], e[2010];
int ns, nb, ne, k;
LL p[2010], hs[2010], hb, he;
set <LL> H;

LL hash(int i, int j)
{
	LL h = hs[j];
	if (i) h -= hs[i-1];
	h *= p[ns-i-1];
	return h;
}

int main()
{
#ifndef ONLINE_JUDGE
 	freopen("input.txt", "r", stdin);
 	freopen("output.txt", "w", stdout);
#endif

	scanf("%s%s%s", s, b, e);

	ns = strlen(s);
	nb = strlen(b);
	ne = strlen(e);

	p[0] = 1;
	for (int i = 1; i < ns; ++i)
		p[i] = p[i-1] * 3113;

	for (int i = 0; i < ns; ++i)
	{
	 	hs[i] = (s[i]-'a'+1) * p[i];
	 	if (i) hs[i] += hs[i-1];
	}

	for (int i = 0; i < nb; ++i)
		hb += (b[i]-'a'+1) * p[i];

	for (int i = 0; i < ne; ++i)
		he += (e[i]-'a'+1) * p[i];

	hb *= p[ns-1];
	he *= p[ns-1];
	int res = 0;
	for (int l = max(nb, ne); l <= ns; ++l)
	{
		for (int i = 0; i+l-1 < ns; ++i)
			if (hash(i, i+nb-1) == hb && hash(i+l-ne, i+l-1) == he)
				H.insert(hash(i, i+l-1));
		res += H.size();
		H.clear();
	}

	printf("%d", res);

	return 0;
}


#include <cstdio>
#include <string>
#include <iostream>
#include <algorithm>

using namespace std;

#define dbg(...) fprintf(stderr, __VA_ARGS__)
#define LL long long

string text, begin, end;
LL hash[2005], hbegin, hend, p[2005];

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

 	cin >> text >> begin >> end;
	p[0] = 1;
	for (int i = 1; i < text.length(); i++)
		p[i] = p[i-1] * 1000007;

	for (int i = 0; i < text.length(); i++) {
	 	hash[i] = (text[i]-'a' + 1) * p[i];
	 	if (i) hash[i] += hash[i-1];
	}

	for (int i = 0; i < begin.length(); i++)
		hbegin += (begin[i]-'a'+1)*p[i];
	for (int i = 0; i < end.length(); i++)
		hend += (end[i]-'a'+1)*p[i];

	hbegin *= p[(text.length()-1)-(begin.length()-1)];
	hend *= p[(text.length()-1)-(end.length()-1)];

	LL ans = 0;
	for (int i = 0; i+begin.length()-1 < text.length(); i++) {
	 	LL h1 = hash[i+begin.length()-1];
	 	if (i)
	 		h1 -= hash[i-1];
	 	h1 *= p[(text.length()-1)-(i+begin.length()-1)];
	 	if (h1 != hbegin) continue;
	 	for (int j = i; j+end.length()-1 < min(text.length(), i+begin.length()+1); j++) {
			LL h2 = hash[j+end.length()-1];
			if (j)
				h2 -= hash[j-1];
			h2 *= p[(text.length()-1)-(j+end.length()-1)];
			if (h2 == hend)
				++ans;
	 	}
	}
	cout << ans;

 	return 0;
}


#include <set>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>

using namespace std;

#define LL long long

char s[2010], b[2010], e[2010];
int ns, nb, ne, k;
LL p[2010], hs[2010], hb, he, H[3000005];

LL hash(int i, int j)
{
	LL h = hs[j];
	if (i) h -= hs[i-1];
	h *= p[ns-i-1];
	return h;
}

int main()
{
#ifndef ONLINE_JUDGE
 	freopen("input.txt", "r", stdin);
 	freopen("output.txt", "w", stdout);
#endif

	scanf("%s%s%s", s, b, e);

	ns = strlen(s);
	nb = strlen(b);
	ne = strlen(e);

	p[0] = 1;
	for (int i = 1; i < ns; ++i)
		p[i] = p[i-1] * 3113;

	for (int i = 0; i < ns; ++i)
	{
	 	hs[i] = (s[i]-'a'+1) * p[i];
	 	if (i) hs[i] += hs[i-1];
	}

	for (int i = 0; i < nb; ++i)
		hb += (b[i]-'a'+1) * p[i];

	for (int i = 0; i < ne; ++i)
		he += (e[i]-'a'+1) * p[i];

	hb *= p[ns-1];
	he *= p[ns-1];
	for (int l = max(nb, ne); l <= ns; ++l)
	{
		for (int i = 0; i+l-1 < ns; ++i)
			if (hash(i, i+nb-1) == hb && hash(i+l-ne, i+l-1) == he)
				H[k++] = hash(i, i+l-1);
	}
	int res = k > 0;
	for (int i = 1; i < k; ++i)
		if (H[i] != H[i-1]) ++res;
	printf("%d", res);

	return 0;
}


#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>

using namespace std;

#define LL long long

char s[2010], b[2010], e[2010];
int ns, nb, ne, k;
LL p[2010], hs[2010], hb, he, H[2000005];

LL hash(int i, int j)
{
	LL h = hs[j];
	if (i) h -= hs[i-1];
	h *= p[ns-i-1];
	return h;
}

int main()
{
#ifndef ONLINE_JUDGE
 	freopen("input.txt", "r", stdin);
 	freopen("output.txt", "w", stdout);
#endif

	scanf("%s%s%s", s, b, e);

	ns = strlen(s);
	nb = strlen(b);
	ne = strlen(e);

	p[0] = 1;
	for (int i = 1; i < 2005; ++i)
		p[i] = p[i-1] * 3113;

	for (int i = 0; i < ns; ++i)
	{
	 	hs[i] = (s[i]-'a'+1) * p[i];
	 	if (i) hs[i] += hs[i-1];
	}

	for (int i = 0; i < nb; ++i)
		hb += (b[i]-'a'+1) * p[i];

	for (int i = 0; i < ne; ++i)
		he += (e[i]-'a'+1) * p[i];

	hb *= p[ns-1];
	he *= p[ns-1];
	for (int l = nb; l <= ns; ++l)
	{
		for (int i = 0; i+l-1 < ns; ++i)
			if (hash(i, i+nb-1) == hb && hash(i+l-ne, i+l-1) == he)
				H[k++] = hash(i, i+l-1);
	}

	if (!k)
	{
	 	puts("0");
	 	return 0;
	}

	sort(H, H+k);
	int res = 1;
	for (int i = 1; i < k; ++i)
		if (H[i] != H[i-1]) ++res;

	printf("%d", res);

	return 0;
}


#include <set>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>

using namespace std;

#define LL long long

char s[2020], b[2020], e[2020];
int ns, nb, ne, k;
LL p[2020], hs[2020], hb, he, H[3000005];

LL hash(int i, int j)
{
	LL h = hs[j];
	if (i) h -= hs[i-1];
	h *= p[ns-1-i];
	return h;
}

int main()
{
#ifndef ONLINE_JUDGE
 	freopen("input.txt", "r", stdin);
 	freopen("output.txt", "w", stdout);
#endif

	scanf("%s%s%s", s, b, e);

	ns = strlen(s);
	nb = strlen(b);
	ne = strlen(e);

	p[0] = 1;
	for (int i = 1; i <= 2010; ++i) p[i] = p[i-1] * 37 * 31923 * 123181;

	for (int i = 0; i < ns; ++i)
	{
	 	hs[i] = (s[i]-'a'+1) * p[i];
	 	if (i) hs[i] += hs[i-1];
	}

	for (int i = 0; i < nb; ++i)
		hb += (b[i]-'a'+1) * p[i];

	for (int i = 0; i < ne; ++i)
		he += (e[i]-'a'+1) * p[i];

	hb *= p[ns-1];
	he *= p[ns-1];

	int res = 0;
	for (int l = 1; l <= ns; ++l)
	{
		if (l < nb || l < ne) continue;
		for (int i = 0; i+l-1 < ns; ++i)
			if (hash(i, i+nb-1) == hb && hash(i+l-ne, i+l-1) == he)
				H[k++] = hash(i, i+l-1);
	}
	sort(H, H+k);
	res = k > 0;
	for (int i = 1; i < k; ++i)
		if (H[i] != H[i-1]) ++res;
	printf("%d", res);

	return 0;
}


#include <cstdio>
#include <string>
#include <iostream>
#include <algorithm>

using namespace std;

#define dbg(...) fprintf(stderr, __VA_ARGS__)
#define LL long long

string text, begin, end;
LL hash[2005], hbegin, hend, p[2005];

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

 	cin >> text >> begin >> end;
	p[0] = 1;
	for (int i = 1; i < text.length(); i++)
		p[i] = p[i-1] * 11231281;

	for (int i = 0; i < text.length(); i++) {
	 	hash[i] = (text[i]-'a' + 1) * p[i];
	 	if (i) hash[i] += hash[i-1];
	}

	for (int i = 0; i < begin.length(); i++)
		hbegin += (begin[i]-'a'+1)*p[i];
	for (int i = 0; i < end.length(); i++)
		hend += (end[i]-'a'+1)*p[i];

	hbegin *= p[(text.length()-1)-(begin.length()-1)];
	hend *= p[(text.length()-1)-(end.length()-1)];

	int ans = 0;
	for (int i = 0; i+begin.length()-1 < text.length(); i++) {
	 	LL h1 = hash[i+begin.length()-1];
	 	if (i)
	 		h1 -= hash[i-1];
	 	h1 *= p[(text.length()-1)-(i+begin.length()-1)];
	 	if (h1 != hbegin) continue;
	 	for (int j = i; j+end.length()-1 < min(text.length(), i+begin.length()+1); j++) {
			LL h2 = hash[j+end.length()-1];
			if (j)
				h2 -= hash[j-1];
			h2 *= p[(text.length()-1)-(j+end.length()-1)];
			if (h2 == hend)
				++ans;
	 	}
	}
	cout << ans;

 	return 0;
}


#include <set>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>

using namespace std;

#define LL long long

char s[2010], b[2010], e[2010];
int ns, nb, ne, k;
LL p[2010], hs[2010], hb, he;
set <LL> H;

LL hash(int i, int j)
{
	LL h = hs[j];
	if (i) h -= hs[i-1];
	h *= p[ns-i-1];
	return h;
}

int main()
{
#ifndef ONLINE_JUDGE
 	freopen("input.txt", "r", stdin);
 	freopen("output.txt", "w", stdout);
#endif

	scanf("%s%s%s", s, b, e);

	ns = strlen(s);
	nb = strlen(b);
	ne = strlen(e);

	p[ns-1] = 1;
	for (int i = ns-2; i >= 0; --i)
		p[i] = p[i+1] * 3113;

	for (int i = 0; i < ns; ++i)
	{
	 	hs[i] = (s[i]-'a'+1) * p[i];
	 	if (i) hs[i] += hs[i-1];
	}

	for (int i = 0; i < nb; ++i)
		hb += (b[i]-'a'+1) * p[i];

	for (int i = 0; i < ne; ++i)
		he += (e[i]-'a'+1) * p[i];

//	hb *= p[ns-1];
//	he *= p[ns-1];
	int res = 0;
	for (int l = max(nb, ne); l <= ns; ++l)
	{
		for (int i = 0; i+l-1 < ns; ++i)
			if (hash(i, i+nb-1) == hb && hash(i+l-ne, i+l-1) == he)
				H.insert(hash(i, i+l-1));
		res += H.size();
		H.clear();
	}

	printf("%d", res);

	return 0;
}


#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>

using namespace std;

#define LL long long

char s[2010], b[2010], e[2010];
int ns, nb, ne, k;
LL p[2010], hs[2010], hb, he, H[2000005];

LL hash(int i, int j)
{
	LL h = hs[j];
	if (i) h -= hs[i-1];
	h *= p[ns-i-1];
	return h;
}

int main()
{
#ifndef ONLINE_JUDGE
 	freopen("input.txt", "r", stdin);
 	freopen("output.txt", "w", stdout);
#endif

	scanf("%s%s%s", s, b, e);

	ns = strlen(s);
	nb = strlen(b);
	ne = strlen(e);

	p[0] = 1;
	for (int i = 1; i < 2005; ++i)
		p[i] = p[i-1] * 3113;

	for (int i = 0; i < ns; ++i)
	{
	 	hs[i] = (s[i]-'a'+1) * p[i];
	 	if (i) hs[i] += hs[i-1];
	}

	for (int i = 0; i < nb; ++i)
		hb += (b[i]-'a'+1) * p[i];

	for (int i = 0; i < ne; ++i)
		he += (e[i]-'a'+1) * p[i];

	hb *= p[ns-1];
	he *= p[ns-1];
	for (int l = 1; l <= ns; ++l)
	{
		if (l < nb || l < ne) continue;
		for (int i = 0; i+l-1 < ns; ++i)
			if (hash(i, i+nb-1) == hb && hash(i+l-ne, i+l-1) == he)
				H[k++] = hash(i, i+l-1);
	}

	if (!k)
	{
	 	puts("0");
	 	return 0;
	}

	sort(H, H+k);
	int res = 1;
	for (int i = 1; i < k; ++i)
		if (H[i] != H[i-1]) ++res;

	printf("%d", res);

	return 0;
}


#include <set>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>

using namespace std;

#define LL long long

char s[2010], b[2010], e[2010];
int ns, nb, ne, k;
LL p[2010], hs[2010], hb, he, H[3000005];

LL hash(int i, int j)
{
	LL h = hs[j];
	if (i) h -= hs[i-1];
	h *= p[ns-i-1];
	return h;
}

int main()
{
#ifndef ONLINE_JUDGE
 	freopen("input.txt", "r", stdin);
 	freopen("output.txt", "w", stdout);
#endif

	scanf("%s%s%s", s, b, e);

	ns = strlen(s);
	nb = strlen(b);
	ne = strlen(e);

	p[0] = 1;
	for (int i = 1; i < ns; ++i)
		p[i] = p[i-1] * 31;

	for (int i = 0; i < ns; ++i)
	{
	 	hs[i] = (s[i]-'a'+1) * p[i];
	 	if (i) hs[i] += hs[i-1];
	}

	for (int i = 0; i < nb; ++i)
		hb += (b[i]-'a'+1) * p[i];

	for (int i = 0; i < ne; ++i)
		he += (e[i]-'a'+1) * p[i];

	hb *= p[ns-1];
	he *= p[ns-1];
	for (int l = max(nb, ne); l <= ns; ++l)
	{
		for (int i = 0; i+l-1 < ns; ++i)
			if (hash(i, i+nb-1) == hb && hash(i+l-ne, i+l-1) == he)
				H[k++] = hash(i, i+l-1);
	}
	int res = k > 0;
	for (int i = 1; i < k; ++i)
		if (H[i] != H[i-1]) ++res;
	printf("%d", res);

	return 0;
}


#include <cstdio>
#include <string>
#include <iostream>
#include <algorithm>

using namespace std;

#define dbg(...) fprintf(stderr, __VA_ARGS__)
#define LL long long

string text, begin, end;
LL hash[2005], hbegin, hend, p[2005];

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

 	cin >> text >> begin >> end;
	p[0] = 1;
	for (int i = 1; i < text.length(); i++)
		p[i] = p[i-1] * 31;

	for (int i = 0; i < text.length(); i++) {
	 	hash[i] = (text[i]-'a' + 1) * p[i];
	 	if (i) hash[i] += hash[i-1];
	}

	for (int i = 0; i < begin.length(); i++)
		hbegin += (begin[i]-'a'+1)*p[i];
	for (int i = 0; i < end.length(); i++)
		hend += (end[i]-'a'+1)*p[i];

	hbegin *= p[(text.length()-1)-(begin.length()-1)];
	hend *= p[(text.length()-1)-(end.length()-1)];

	int ans = 0;
	for (int i = 0; i+begin.length()-1 < text.length(); i++) {
	 	LL h1 = hash[i+begin.length()-1];
	 	if (i)
	 		h1 -= hash[i-1];
	 	h1 *= p[(text.length()-1)-(i+begin.length()-1)];
	 	if (h1 != hbegin) continue;
	 	for (int j = i; j+end.length()-1 < min(text.length(), i+begin.length()+1); j++) {
			LL h2 = hash[j+end.length()-1];
			if (j)
				h2 -= hash[j-1];
			h2 *= p[(text.length()-1)-(j+end.length()-1)];
			if (h2 == hend)
				++ans;
	 	}
	}
	cout << ans;

 	return 0;
}


#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>

using namespace std;

#define LL long long

char s[2010], b[2010], e[2010];
int ns, nb, ne, k;
LL p[2010], hs[2010], hb, he, H[2000005];

LL hash(int i, int j)
{
	LL h = hs[j];
	if (i) h -= hs[i-1];
	h *= p[ns-i-1];
	return h;
}

int main()
{
#ifndef ONLINE_JUDGE
 	freopen("input.txt", "r", stdin);
 	freopen("output.txt", "w", stdout);
#endif

	scanf("%s%s%s", s, b, e);

	ns = strlen(s);
	nb = strlen(b);
	ne = strlen(e);

	p[ns-1] = 1;
	for (int i = ns-2; i >= 0; --i)
		p[i] = p[i+1] * 3113;

	for (int i = 0; i < ns; ++i)
	{
	 	hs[i] = (s[i]-'a'+1) * p[i];
	 	if (i) hs[i] += hs[i-1];
	}

	for (int i = 0; i < nb; ++i)
		hb += (b[i]-'a'+1) * p[i];

	for (int i = 0; i < ne; ++i)
		he += (e[i]-'a'+1) * p[i];

//	hb *= p[ns-1];
//	he *= p[ns-1];
	for (int l = 1; l <= ns; ++l)
	{
		if (l < nb || l < ne) continue;
		for (int i = 0; i+l-1 < ns; ++i)
			if (hash(i, i+nb-1) == hb && hash(i+l-ne, i+l-1) == he)
				H[k++] = hash(i, i+l-1);
	}

	if (!k)
	{
	 	puts("0");
	 	return 0;
	}

	sort(H, H+k);
	int res = 1;
	for (int i = 1; i < k; ++i)
		if (H[i] != H[i-1]) ++res;

	printf("%d", res);

	return 0;
}


//Author : Tariqul Islam Sarker
//#include "stdafx.h"

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define fo(i,j,n) for(i=j;i<n;++i)
#define Fo(i,j,n) for(i=n-1;i>=j;--i)
#define foo(i,j,v) fo(i,j,sz(v))
#define Foo(i,j,v) Fo(i,j,sz(v))
#define li(v) v.begin(),v.end()
#define sz(v) ((int)v.size())
#define CLR(a,v) memset((a),(v),sizeof(a))
#define inf 1000000001
typedef unsigned long long Long;
//typedef __int64 Long;
#define pi (2*acos(0))
#define eps 1e-9

#define two(X) (1<<(X))
#define twoL(X) (((Long)(1))<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define containL(S,X) (((S)&twoL(X))!=0)

char BUFFER[100000 + 5];
bool readn(int &n)	{ return scanf("%d",&n) == 1; }
bool readl(Long &n)	{ return scanf("%I64d",&n) == 1; }
bool readd(double &n){ return scanf("%lf",&n) == 1; }
bool reads(string &s){ s = ""; int n = scanf("%s",BUFFER); if(n == 1)s = BUFFER; return n == 1; }
bool readln(string &s){ char *valid = gets(BUFFER); if(valid)s = BUFFER; return ((bool)valid); }

const int maxn = 2000 + 5;
const int mod = 4000000;
string s,pre,suf,tmp;
Long H[maxn][maxn];
set<Long> x[mod];
bool found1[maxn],found2[maxn];
int ans = 0;
int main()
{
	//freopen("D://input.txt","r",stdin);
	reads(s); reads(pre); reads(suf); CLR(found1,false); CLR(found2,false);
	int i = 0,j = 0,n = max(sz(pre),sz(suf)); fo(i,0,mod)x[i].clear();
	if(n > sz(s)){ cout << "0\n"; return 0; }

	foo(i,0,s){ i = s.find(pre,i); if(i == -1)break; found1[i] = true; }
	foo(i,0,s){ i = s.find(suf,i); if(i == -1)break; found2[i+sz(suf)-1] = true; }
	foo(i,0,s)
	{
		H[i][i] = (s[i]-'a'+1);
		foo(j,i+1,s){ H[i][j] = H[i][j-1]*29; H[i][j] += (s[j]-'a'+1); }
	}
	foo(i,0,s)if(found1[i])foo(j,(i+n-1),s)if(found2[j])
	{
		x[(int)(H[i][j]%mod)].insert(H[i][j]);
	}
	fo(i,0,mod)ans += sz(x[i]);
	cout << ans;

	printf("\n");
	return 0;
}


//Author : Tariqul Islam Sarker
//#include "stdafx.h"

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define fo(i,j,n) for(i=j;i<n;++i)
#define Fo(i,j,n) for(i=n-1;i>=j;--i)
#define foo(i,j,v) fo(i,j,sz(v))
#define Foo(i,j,v) Fo(i,j,sz(v))
#define li(v) v.begin(),v.end()
#define sz(v) ((int)v.size())
#define CLR(a,v) memset((a),(v),sizeof(a))
#define inf 1000000001
typedef unsigned long long Long;
//typedef __int64 Long;
#define pi (2*acos(0))
#define eps 1e-9

#define two(X) (1<<(X))
#define twoL(X) (((Long)(1))<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define containL(S,X) (((S)&twoL(X))!=0)

char BUFFER[100000 + 5];
bool readn(int &n)	{ return scanf("%d",&n) == 1; }
bool readl(Long &n)	{ return scanf("%I64d",&n) == 1; }
bool readd(double &n){ return scanf("%lf",&n) == 1; }
bool reads(string &s){ s = ""; int n = scanf("%s",BUFFER); if(n == 1)s = BUFFER; return n == 1; }
bool readln(string &s){ char *valid = gets(BUFFER); if(valid)s = BUFFER; return ((bool)valid); }

const int maxn = 2000 + 5;
const int mod = 2000000;
string s,pre,suf,tmp;
Long H[maxn][maxn];
set<Long> x[mod];
bool found1[maxn],found2[maxn];

int last[mod + 1], nx[2000001],ans = 0;
Long key[2000001];
void add(Long cur) {
        int h = cur % mod;

        for (int w = last[h]; w >= 0; w = nx[w]) if (key[w] == cur) return;
        nx[ans] = last[h]; key[ans] = cur; last[h] = ans++;
}

int main()
{
	//freopen("D://input.txt","r",stdin);
	reads(s); reads(pre); reads(suf); CLR(found1,false); CLR(found2,false);	CLR(last,-1);
	int i = 0,j = 0,n = max(sz(pre),sz(suf)); fo(i,0,mod)x[i].clear();
	if(n > sz(s)){ cout << "0\n"; return 0; }

	foo(i,0,s){ i = s.find(pre,i); if(i == -1)break; found1[i] = true; }
	foo(i,0,s){ i = s.find(suf,i); if(i == -1)break; found2[i+sz(suf)-1] = true; }
	foo(i,0,s)
	{
		H[i][i] = (s[i]-'a'+1);
		foo(j,i+1,s){ H[i][j] = H[i][j-1]*29; H[i][j] += (s[j]-'a'+1); }
	}
	foo(i,0,s)if(found1[i])foo(j,(i+n-1),s)if(found2[j])
	{
		//add(H[i][j]);
		x[(int)(H[i][j]%mod)].insert(H[i][j]);
	}
	fo(i,0,mod)ans += sz(x[i]);
	cout << ans;

	printf("\n");
	return 0;
}


//Author : Tariqul Islam Sarker
//#include "stdafx.h"

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define fo(i,j,n) for(i=j;i<n;++i)
#define Fo(i,j,n) for(i=n-1;i>=j;--i)
#define foo(i,j,v) fo(i,j,sz(v))
#define Foo(i,j,v) Fo(i,j,sz(v))
#define li(v) v.begin(),v.end()
#define sz(v) ((int)v.size())
#define CLR(a,v) memset((a),(v),sizeof(a))
#define inf 1000000001
typedef unsigned int Long;
//typedef __int64 Long;
#define pi (2*acos(0))
#define eps 1e-9

#define two(X) (1<<(X))
#define twoL(X) (((Long)(1))<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define containL(S,X) (((S)&twoL(X))!=0)

char BUFFER[100000 + 5];
bool readn(int &n)	{ return scanf("%d",&n) == 1; }
bool readl(Long &n)	{ return scanf("%I64d",&n) == 1; }
bool readd(double &n){ return scanf("%lf",&n) == 1; }
bool reads(string &s){ s = ""; int n = scanf("%s",BUFFER); if(n == 1)s = BUFFER; return n == 1; }
bool readln(string &s){ char *valid = gets(BUFFER); if(valid)s = BUFFER; return ((bool)valid); }

const int maxn = 2000 + 5;
const int mod = 4000000;
string s,pre,suf,tmp;
Long H[maxn][maxn];
set<Long> x[mod];
bool found1[maxn],found2[maxn];
int ans = 0;
int main()
{
	//freopen("D://input.txt","r",stdin);
	reads(s); reads(pre); reads(suf); CLR(found1,false); CLR(found2,false);
	int i = 0,j = 0,n = max(sz(pre),sz(suf)); fo(i,0,mod)x[i].clear();
	if(n > sz(s)){ cout << "0\n"; return 0; }

	foo(i,0,s){ i = s.find(pre,i); if(i == -1)break; found1[i] = true; }
	foo(i,0,s){ i = s.find(suf,i); if(i == -1)break; found2[i+sz(suf)-1] = true; }
	foo(i,0,s)
	{
		H[i][i] = (s[i]-'a'+1);
		foo(j,i+1,s){ H[i][j] = H[i][j-1]*29; H[i][j] += (s[j]-'a'+1); }
	}
	foo(i,0,s)if(found1[i])foo(j,(i+n-1),s)if(found2[j])
	{
		x[(int)(H[i][j]%mod)].insert(H[i][j]);
	}
	fo(i,0,mod)ans += sz(x[i]);
	cout << ans;

	printf("\n");
	return 0;
}


//Author : Tariqul Islam Sarker
//#include "stdafx.h"

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define fo(i,j,n) for(i=j;i<n;++i)
#define Fo(i,j,n) for(i=n-1;i>=j;--i)
#define foo(i,j,v) fo(i,j,sz(v))
#define Foo(i,j,v) Fo(i,j,sz(v))
#define li(v) v.begin(),v.end()
#define sz(v) ((int)v.size())
#define CLR(a,v) memset((a),(v),sizeof(a))
#define inf 1000000001
typedef unsigned long long Long;
//typedef __int64 Long;
#define pi (2*acos(0))
#define eps 1e-9

#define two(X) (1<<(X))
#define twoL(X) (((Long)(1))<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define containL(S,X) (((S)&twoL(X))!=0)

char BUFFER[100000 + 5];
bool readn(int &n)	{ return scanf("%d",&n) == 1; }
bool readl(Long &n)	{ return scanf("%I64d",&n) == 1; }
bool readd(double &n){ return scanf("%lf",&n) == 1; }
bool reads(string &s){ s = ""; int n = scanf("%s",BUFFER); if(n == 1)s = BUFFER; return n == 1; }
bool readln(string &s){ char *valid = gets(BUFFER); if(valid)s = BUFFER; return ((bool)valid); }

const int maxn = 2000 + 5;
const int mod = 100000;
string s,pre,suf,tmp;
Long H[maxn][maxn];
set<Long> x[mod];
bool found1[maxn],found2[maxn];
int ans = 0;
int main()
{
	//freopen("D://input.txt","r",stdin);
	reads(s); reads(pre); reads(suf); CLR(found1,false); CLR(found2,false);
	int i = 0,j = 0,n = max(sz(pre),sz(suf)); fo(i,0,mod)x[i].clear();
	if(n > sz(s)){ cout << "0\n"; return 0; }

	foo(i,0,s){ i = s.find(pre,i); if(i == -1)break; found1[i] = true; }
	foo(i,0,s){ i = s.find(suf,i); if(i == -1)break; found2[i+sz(suf)-1] = true; }
	foo(i,0,s)
	{
		H[i][i] = (s[i]-'a'+1);
		foo(j,i+1,s){ H[i][j] = H[i][j-1]*29; H[i][j] += (s[j]-'a'+1); }
	}
	foo(i,0,s)if(found1[i])foo(j,(i+n-1),s)if(found2[j])
	{
		x[(int)(H[i][j]%mod)].insert(H[i][j]);
	}
	fo(i,0,mod)ans += sz(x[i]);
	cout << ans;

	printf("\n");
	return 0;
}


//#include "stdafx.h"

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define fo(i,j,n) for(i=j;i<n;++i)
#define Fo(i,j,n) for(i=n-1;i>=j;--i)
#define foo(i,j,v) fo(i,j,sz(v))
#define Foo(i,j,v) Fo(i,j,sz(v))
#define li(v) v.begin(),v.end()
#define sz(v) ((int)v.size())
#define CLR(a,v) memset((a),(v),sizeof(a))
#define inf 1000000001
//typedef long long Long;
typedef __int64 Long;
#define pi (2*acos(0))
#define eps 1e-9

#define two(X) (1<<(X))
#define twoL(X) (((Long)(1))<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define containL(S,X) (((S)&twoL(X))!=0)

char BUFFER[100000 + 5];
bool readn(int &n)	{ return scanf("%d",&n) == 1; }
bool readl(Long &n)	{ return scanf("%I64d",&n) == 1; }
bool readd(double &n){ return scanf("%lf",&n) == 1; }
bool reads(string &s){ s = ""; int n = scanf("%s",BUFFER); if(n == 1)s = BUFFER; return n == 1; }
bool readln(string &s){ char *valid = gets(BUFFER); if(valid)s = BUFFER; return ((bool)valid); }

string s,pre,suf,tmp;
set<string> x;
int main()
{
	//freopen("D://input.txt","r",stdin);
	reads(s); reads(pre); reads(suf); x.clear();
	int i = 0,j = 0,n = max(sz(pre),sz(suf));
	while(1)
	{
		i = s.find(pre,i); if(i == -1)break;
		j = i + n - sz(suf);
		while(1)
		{
			j = s.find(suf,j); if(j == -1)break;
			tmp = s.substr(i,j + sz(suf) - i);
			x.insert(tmp);
			j++;
		}
		i++;
	}
	cout << sz(x);

	printf("\n");
	return 0;
}


//Author : Tariqul Islam Sarker
//#include "stdafx.h"

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define fo(i,j,n) for(i=j;i<n;++i)
#define Fo(i,j,n) for(i=n-1;i>=j;--i)
#define foo(i,j,v) fo(i,j,sz(v))
#define Foo(i,j,v) Fo(i,j,sz(v))
#define li(v) v.begin(),v.end()
#define sz(v) ((int)v.size())
#define CLR(a,v) memset((a),(v),sizeof(a))
#define inf 1000000001
typedef unsigned long long Long;
//typedef __int64 Long;
#define pi (2*acos(0))
#define eps 1e-9

#define two(X) (1<<(X))
#define twoL(X) (((Long)(1))<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define containL(S,X) (((S)&twoL(X))!=0)

char BUFFER[100000 + 5];
bool readn(int &n)	{ return scanf("%d",&n) == 1; }
bool readl(Long &n)	{ return scanf("%I64d",&n) == 1; }
bool readd(double &n){ return scanf("%lf",&n) == 1; }
bool reads(string &s){ s = ""; int n = scanf("%s",BUFFER); if(n == 1)s = BUFFER; return n == 1; }
bool readln(string &s){ char *valid = gets(BUFFER); if(valid)s = BUFFER; return ((bool)valid); }

const int maxn = 2000 + 5;
const int mod = 500000;
string s,pre,suf,tmp;
Long H[maxn][maxn];
set<Long> x[mod];
bool found1[maxn],found2[maxn];
int ans = 0;
int main()
{
	//freopen("D://input.txt","r",stdin);
	reads(s); reads(pre); reads(suf); CLR(found1,false); CLR(found2,false);
	int i = 0,j = 0,n = max(sz(pre),sz(suf)); fo(i,0,mod)x[i].clear();
	if(n > sz(s)){ cout << "0\n"; return 0; }

	foo(i,0,s){ i = s.find(pre,i); if(i == -1)break; found1[i] = true; }
	foo(i,0,s){ i = s.find(suf,i); if(i == -1)break; found2[i+sz(suf)-1] = true; }
	foo(i,0,s)
	{
		H[i][i] = (s[i]-'a'+1);
		foo(j,i+1,s){ H[i][j] = H[i][j-1]*29; H[i][j] += (s[j]-'a'+1); }
	}
	foo(i,0,s)if(found1[i])foo(j,(i+n-1),s)if(found2[j])
	{
		x[(int)(H[i][j]%mod)].insert(H[i][j]);
	}
	fo(i,0,mod)ans += sz(x[i]);
	cout << ans;

	printf("\n");
	return 0;
}


//In the Name of God

#include<iostream>
#include<set>
#define ll long long

using namespace std;

const ll M=1e9+7;
bool beg[2200],end[2200];
string a,s,t;
int m,Ans,k;
ll hash;
set<ll> ans[2200];

int main()
{
  cin>>a>>s>>t;
  if(s.size()>a.size() || t.size()>a.size())
    {
      cout<<0<<endl;
      return 0;
    }
  for(int i=0;i<=a.size()-s.size();i++)
    {
      beg[i]=true;
      for(int j=0;j<s.size();j++)
	beg[i]&=(a[i+j]==s[j]);
    }
  for(int i=t.size()-1;i<a.size();i++)
    {
      end[i]=true;
      for(int j=0;j<t.size();j++)
	end[i]&=(a[i-j]==t[t.size()-j-1]);
    }
  m=max(t.size(),s.size());
  for(int i=0;i<a.size();i++)
    if(beg[i])
      {
	hash=0;
	for(int j=i;j<a.size();j++)
	  {
	    hash=((hash*31+a[j]-'a'+1)%M+M)%M;
	    if(end[j] && j-i+1>=m)
	      ans[j-i].insert(hash);
	  }
      }
  for(int i=0;i<2020;i++)
    Ans+=ans[i].size();
  cout<<Ans<<endl;
  return 0;
}


//In the Name of God

#include<iostream>
#include<set>
#define ll long long

using namespace std;

const ll M=1e9+7;
string A,s,t;
ll S,T,m,a[2200],p[2200],Ans;
set<ll> ans[2200];
int aa,tt,ss,mt,az,sz,tz,am,sm,tm,mz,at;

inline ll hash(int f,int l)
{
  if(f==0)
    return a[l];
  return ((a[l]-(a[f-1]*p[l-f+1]))%M+M)%M;
}

int main()
{
  p[0]=1;
  for(int i=1;i<2020;i++)
    p[i]=(p[i-1]*37)%M;
  cin>>A>>s>>t;
  for(int i=0;i<s.size();i++)
    S=((S*37)+(s[i]-'a'+1))%M;
  for(int i=0;i<t.size();i++)
    T=((T*37)+(t[i]-'a'+1))%M;
  a[0]=(A[0]-'a'+1);
  for(int i=1;i<A.size();i++)
    a[i]=((a[i-1]*37)+(A[i]-'a'+1))%M;
  m=max(s.size(),t.size());
  aa=A.size();
  ss=s.size();
  tt=t.size();
  mt=m-t.size();
  at=aa-tt+1;
  am=aa-m+1;
  sz=ss-1;
  tz=tt-1;
  for(int i=0;i<am;i++)
    for(int j=i+mt;j<at;j++)
      if(hash(i,i+sz)==S)
	if(hash(j,j+tz)==T)
	  ans[j-i].insert(hash(i,j+tz));
  for(int i=0;i<2000;i++)
    Ans+=ans[i].size();
  cout<<Ans<<endl;
  return 0;
}


//In the Name of God

#include<iostream>
#include<set>
#define ll long long

using namespace std;

const ll M=1e9+7;
string A,s,t;
ll S,T,m,a[2200],p[2200],Ans,h1[2200],h2[2200];
set<ll> ans[2200];
int aa,tt,ss,mt,az,sz,tz,am,sm,tm,mz,at;

inline ll hash(int f,int l)
{
  if(f==0)
    return a[l];
  return ((a[l]-(a[f-1]*p[l-f+1]))%M+M)%M;
}

int main()
{
  p[0]=1;
  for(int i=1;i<2020;i++)
    p[i]=(p[i-1]*37)%M;
  cin>>A>>s>>t;
  for(int i=0;i<s.size();i++)
    S=((S*37)+(s[i]-'a'+1))%M;
  for(int i=0;i<t.size();i++)
    T=((T*37)+(t[i]-'a'+1))%M;
  a[0]=(A[0]-'a'+1);
  for(int i=1;i<A.size();i++)
    a[i]=((a[i-1]*37)+(A[i]-'a'+1))%M;
  m=max(s.size(),t.size());
  aa=A.size();
  ss=s.size();
  tt=t.size();
  mt=m-t.size();
  at=aa-tt+1;
  am=aa-m+1;
  sz=ss-1;
  tz=tt-1;
  for(int i=0;i<=aa-ss;i++)
    h1[i]=hash(i,i+sz);
  for(int i=0;i<=aa-tt;i++)
    h2[i]=hash(i,i+tz);
  for(int i=0;i<am;i++)
    for(int j=i+mt;j<at;j++)
      if(h1[i]==S)
	if(h2[j]==T)
	  ans[j-i].insert(hash(i,j+tz));
  for(int i=0;i<2000;i++)
    Ans+=ans[i].size();
  cout<<Ans<<endl;
  return 0;
}


//In the Name of God

#include<iostream>
#include<set>
#define ll long long

using namespace std;

const ll M=1e9+7;
string A,s,t;
ll S,T,m,a[2200],p[2200],Ans;
set<ll> ans;

ll hash(int f,int l)
{
  if(f==0)
    return a[l];
  return ((a[l]-(a[f-1]*p[l-f+1]))%M+M)%M;
}

int main()
{
  p[0]=1;
  for(int i=1;i<2020;i++)
    p[i]=(p[i-1]*31)%M;
  cin>>A>>s>>t;
  for(int i=0;i<s.size();i++)
    S=((S*31)+(s[i]-'a'+1))%M;
  for(int i=0;i<t.size();i++)
    T=((T*31)+(t[i]-'a'+1))%M;
  a[0]=(A[0]-'a'+1);
  for(int i=1;i<A.size();i++)
    a[i]=((a[i-1]*31)+(A[i]-'a'+1))%M;
  m=max(s.size(),t.size());
  for(int i=0;i<A.size()-m+1;i++)
    for(int j=i+m-t.size();j<A.size()-t.size()+1;j++)
      if(hash(i,i+s.size()-1)==S && hash(j,j+t.size()-1)==T)
	ans.insert(hash(i,j+t.size()-1));
  cout<<ans.size()<<endl;
  return 0;
}


//In the Name of God

#include<iostream>
#include<set>
#define ll long long

using namespace std;

const ll M=1e9+7;
string A,s,t;
ll S,T,m,a[2200],p[2200],Ans;
set<ll> ans[2200];
int aa,tt,ss,mt;

inline ll hash(int f,int l)
{
  if(f==0)
    return a[l];
  return ((a[l]-(a[f-1]*p[l-f+1]))%M+M)%M;
}

int main()
{
  p[0]=1;
  for(int i=1;i<2020;i++)
    p[i]=(p[i-1]*37)%M;
  cin>>A>>s>>t;
  for(int i=0;i<s.size();i++)
    S=((S*37)+(s[i]-'a'+1))%M;
  for(int i=0;i<t.size();i++)
    T=((T*37)+(t[i]-'a'+1))%M;
  a[0]=(A[0]-'a'+1);
  for(int i=1;i<A.size();i++)
    a[i]=((a[i-1]*37)+(A[i]-'a'+1))%M;
  m=max(s.size(),t.size());
  aa=A.size();
  ss=s.size();
  tt=t.size();
  mt=m-t.size();
  for(int i=0;i<aa-m+1;i++)
    for(int j=i+mt;j<aa-tt+1;j++)
      if(hash(i,i+ss-1)==S)
	if(hash(j,j+tt-1)==T)
	  ans[j-i].insert(hash(i,j+tt-1));
  for(int i=0;i<2000;i++)
    Ans+=ans[i].size();
  cout<<Ans<<endl;
  return 0;
}


//In the Name of God

#include<iostream>
#include<set>
#define ll long long

using namespace std;

const ll M=1e9+7;
string A,s,t;
ll S,T,m,a[2200],p[2200],Ans;
set<ll> ans[2200];
int aa,tt,ss,mt;

inline ll hash(int f,int l)
{
  if(f==0)
    return a[l];
  return ((a[l]-(a[f-1]*p[l-f+1]))%M+M)%M;
}

int main()
{
  p[0]=1;
  for(int i=1;i<2020;i++)
    p[i]=(p[i-1]*37)%M;
  cin>>A>>s>>t;
  for(int i=0;i<s.size();i++)
    S=((S*37)+(s[i]-'a'+1))%M;
  for(int i=0;i<t.size();i++)
    T=((T*37)+(t[i]-'a'+1))%M;
  a[0]=(A[0]-'a'+1);
  for(int i=1;i<A.size();i++)
    a[i]=((a[i-1]*37)+(A[i]-'a'+1))%M;
  m=max(s.size(),t.size());
  aa=A.size();
  ss=s.size();
  tt=t.size();
  mt=m-t.size();
  at=aa-tt+1;
  am=aa-m+1;
  sz=ss-1;
  tz=tt-1;
  for(int i=0;i<am;i++)
    for(int j=i+mt;j<at;j++)
      if(hash(i,i+sz)==S)
	if(hash(j,j+tz)==T)
	  ans[j-i].insert(hash(i,j+tz));
  for(int i=0;i<2000;i++)
    Ans+=ans[i].size();
  cout<<Ans<<endl;
  return 0;
}


//In the Name of God

#include<iostream>
#include<set>
#define ll long long

using namespace std;

const ll M=1e9+7;
bool beg[2200],end[2200];
string a,s,t;
int m,Ans,k;
ll hash;
set<ll> ans[2200];

int main()
{
  cin>>a>>s>>t;
  for(int i=0;i<=a.size()-s.size();i++)
    {
      beg[i]=true;
      for(int j=0;j<s.size();j++)
	beg[i]&=(a[i+j]==s[j]);
    }
  for(int i=t.size()-1;i<a.size();i++)
    {
      end[i]=true;
      for(int j=0;j<t.size();j++)
	end[i]&=(a[i-j]==t[t.size()-j-1]);
    }
  m=max(t.size(),s.size());
  for(int i=0;i<a.size();i++)
    if(beg[i])
      {
	hash=0;
	for(int j=i;j<a.size();j++)
	  {
	    hash=((hash*31+a[j]-'a'+1)%M+M)%M;
	    if(end[j] && j-i+1>=m)
	      ans[j-i].insert(hash);
	  }
      }
  for(int i=0;i<2020;i++)
    Ans+=ans[i].size();
  cout<<Ans<<endl;
  return 0;
}


//In the Name of God

#include<iostream>
#include<set>
#define ll long long

using namespace std;

const ll M=1e9+7;
string A,s,t;
ll S,T,m,a[2200],p[2200],Ans;
set<ll> ans[2200];

ll hash(int f,int l)
{
  if(f==0)
    return a[l];
  return ((a[l]-(a[f-1]*p[l-f+1]))%M+M)%M;
}

int main()
{
  p[0]=1;
  for(int i=1;i<2020;i++)
    p[i]=(p[i-1]*37)%M;
  cin>>A>>s>>t;
  for(int i=0;i<s.size();i++)
    S=((S*37)+(s[i]-'a'+1))%M;
  for(int i=0;i<t.size();i++)
    T=((T*37)+(t[i]-'a'+1))%M;
  a[0]=(A[0]-'a'+1);
  for(int i=1;i<A.size();i++)
    a[i]=((a[i-1]*37)+(A[i]-'a'+1))%M;
  m=max(s.size(),t.size());
  for(int i=0;i<A.size()-m+1;i++)
    for(int j=i+m-t.size();j<A.size()-t.size()+1;j++)
      if(hash(i,i+s.size()-1)==S && hash(j,j+t.size()-1)==T)
	ans[j-i].insert(hash(i,j+t.size()-1));
  for(int i=0;i<2020;i++)
    Ans+=ans[i].size();
  cout<<Ans<<endl;
  return 0;
}


//In the Name of God

#include<iostream>
#include<set>
#define ll long long

using namespace std;

const ll M=1e9+7;
string A,s,t;
ll S,T,m,a[2200],p[2200];
set<ll> ans;

ll hash(int f,int l)
{
  if(f==0)
    return a[l];
  return ((a[l]-(a[f-1]*p[l-f+1]))%M+M)%M;
}

int main()
{
  p[0]=1;
  for(int i=1;i<2020;i++)
    p[i]=(p[i-1]*31)%M;
  cin>>A>>s>>t;
  for(int i=0;i<s.size();i++)
    S=((S*31)+(s[i]-'a'+1))%M;
  for(int i=0;i<t.size();i++)
    T=((T*31)+(s[i]-'a'+1))%M;
  a[0]=(A[0]-'a'+1);
  for(int i=1;i<A.size();i++)
    a[i]=((a[i-1]*31)+(A[i]-'a'+1))%M;
  m=max(s.size(),t.size());
  for(int i=0;i<A.size()-m+1;i++)
    for(int j=i+m-t.size();j<A.size()-t.size()+1;j++)
      if(hash(i,i+s.size()-1)==S && hash(j,j+t.size()-1)==T)
	ans.insert(hash(i,j+t.size()-1));
  cout<<ans.size()<<endl;
  return 0;
}


//In the Name of God

#include<iostream>
#include<set>
#define ll long long

using namespace std;

const ll M=1e9+7;
string A,s,t;
ll S,T,m,a[2200],p[2200],Ans;
set<ll> ans;

ll hash(int f,int l)
{
  if(f==0)
    return a[l];
  return ((a[l]-(a[f-1]*p[l-f+1]))%M+M)%M;
}

int main()
{
  p[0]=1;
  for(int i=1;i<2020;i++)
    p[i]=(p[i-1]*37)%M;
  cin>>A>>s>>t;
  for(int i=0;i<s.size();i++)
    S=((S*37)+(s[i]-'a'+1))%M;
  for(int i=0;i<t.size();i++)
    T=((T*37)+(t[i]-'a'+1))%M;
  a[0]=(A[0]-'a'+1);
  for(int i=1;i<A.size();i++)
    a[i]=((a[i-1]*37)+(A[i]-'a'+1))%M;
  m=max(s.size(),t.size());
  for(int i=0;i<A.size()-m+1;i++)
    for(int j=i+m-t.size();j<A.size()-t.size()+1;j++)
      if(hash(i,i+s.size()-1)==S && hash(j,j+t.size()-1)==T)
	ans.insert(hash(i,j+t.size()-1));
  cout<<ans.size()<<endl;
  return 0;
}


#include <iostream>
#include <cmath>
#include <cassert>
#include <cstdio>
#include <ctime>
#include <queue>
#include <fstream>
#include <set>
#include <utility>
#include <map>
#include <sstream>
#include <vector>
#include <cstring>

using namespace std;

#define MAXN 5010
#define MAXM 5010
#define MAXP 1000000

#define in cin
#define out cout
#define dout if(true) cout

typedef long long num;
#define BASE 26
#define PRIME 111234567ll
#define RAND 17

#define MAXL 2010

num T[MAXL];
num A[MAXL];
num B[MAXL];

num pw[MAXL];
num invpw[MAXL];

bool seen[PRIME];

num gcd(num a, num b, num& x, num& y){
	if (a==0){
		x = 0;
		y = 1;
		return b;
	}else if (b==0){
		x=1;
		y=0;
		return a;
	}else{
		num x1,y1;
		num g = gcd(b,a%b,x1,y1);

		x = y1;
		y = x1-(a/b)*y1;

		return g;
	}
}

num inv(num a){
	num x,y;
	num g = gcd(a,PRIME,x,y);
	assert(g==1);

	if (x>0) return x%PRIME;

	return (PRIME - ((-x)%PRIME))%PRIME;
}

num make_hash(string x, num* L){
	int N = x.size();
	L[0] = 0;

	for (int i=0;i<N;i++){
		L[i+1] = (L[i])%PRIME;
		L[i+1] += (((num)(x[i]-'a'+1+RAND))*pw[i])%PRIME;
		L[i+1] %= PRIME;
	}

	return L[N];
}

void calcpow()
{
	pw[0] = 1;
	invpw[0] = 1;
	for (int i=1;i<MAXL;i++){
		pw[i] = pw[i-1]*BASE;
		pw[i] %= PRIME;

		invpw[i] = inv(pw[i])%PRIME;
	}
}

num v(num*L, int i, int N){
	num ans = L[i+N] - L[i];

	if (ans < 0) ans = (PRIME - ((-ans)%PRIME))%PRIME;
	ans %= PRIME;

	ans *= invpw[i];
	ans %= PRIME;
	return ans;
}

int main(){
	string t,a,b;
	in >> t >> a >> b;

	calcpow();

	make_hash(t,T);
	num ha = make_hash(a,A);
	num hb = make_hash(b,B);

	int tlen = t.size();
	int alen = a.size();
	int blen = b.size();

	int ans = 0;

	//set<num> seen;

	for (int i=0;i+alen<=tlen;i++){
		for (int j=max(i+alen-blen,i);j+blen<=tlen;j++){
			if (v(T,i,alen) == ha){
				if (v(T,j,blen) == hb){
					num vx = v(T,i,(j-i)-1+blen);
					if (seen[vx]) continue;
					//if (seen.find(vx) != seen.end()) continue;
					ans ++;
					//seen.insert(vx);
					seen[vx] = true;
				}
			}
		}
	}

	out << ans << endl;
}


#include <iostream>
#include <cmath>
#include <cassert>
#include <cstdio>
#include <ctime>
#include <queue>
#include <fstream>
#include <set>
#include <utility>
#include <map>
#include <sstream>
#include <vector>
#include <cstring>

using namespace std;

#define MAXN 5010
#define MAXM 5010
#define MAXP 1000000

#define in cin
#define out cout
#define dout if(true) cout

typedef long long num;
#define BASE 31
#define PRIME 23987419612371ll
#define RAND 3

#define MAXL 2010

num T[MAXL];
num A[MAXL];
num B[MAXL];

num pw[MAXL];
num invpw[MAXL];

num gcd(num a, num b, num& x, num& y){
	if (a==0){
		x = 0;
		y = 1;
		return b;
	}else if (b==0){
		x=1;
		y=0;
		return a;
	}else{
		num x1,y1;
		num g = gcd(b,a%b,x1,y1);

		x = y1;
		y = x1-(a/b)*y1;

		return g;
	}
}

num inv(num a){
	num x,y;
	num g = gcd(a,PRIME,x,y);
	assert(g==1);

	if (x>0) return x%PRIME;

	return (PRIME - ((-x)%PRIME))%PRIME;
}

num make_hash(string x, num* L){
	int N = x.size();
	L[0] = 0;

	for (int i=0;i<N;i++){
		L[i+1] = (L[i])%PRIME;
		L[i+1] += (((int)(x[i]-'a'+1+RAND))*pw[i])%PRIME;
		L[i+1] %= PRIME;
	}

	return L[N];
}

void calcpow()
{
	pw[0] = 1;
	invpw[0] = 1;
	for (int i=1;i<MAXL;i++){
		pw[i] = pw[i-1]*BASE;
		pw[i] %= PRIME;

		invpw[i] = inv(pw[i])%PRIME;
	}
}

num v(num*L, int i, int N){
	num ans = L[i+N] - L[i];

	if (ans < 0) ans = (PRIME - ((-ans)%PRIME))%PRIME;
	ans %= PRIME;

	ans *= invpw[i];
	ans %= PRIME;
	return ans;
}

int main(){
	string t,a,b;
	in >> t >> a >> b;

	calcpow();

	make_hash(t,T);
	num ha = make_hash(a,A);
	num hb = make_hash(b,B);

	int tlen = t.size();
	int alen = a.size();
	int blen = b.size();

	int ans = 0;

	set<num> seen;

	for (int i=0;i+alen<=tlen;i++){
		for (int j=max(i+alen-blen,i);j+blen<=tlen;j++){
			if (v(T,i,alen) == ha){
				if (v(T,j,blen) == hb){
					num vx = v(T,i,(j-i)-1+blen);
					if (seen.find(vx) != seen.end()) continue;
					ans ++;
					seen.insert(vx);
				}
			}
		}
	}

	out << ans << endl;
}


#include <iostream>
#include <cmath>
#include <cassert>
#include <cstdio>
#include <ctime>
#include <queue>
#include <fstream>
#include <set>
#include <utility>
#include <map>
#include <sstream>
#include <vector>
#include <cstring>

using namespace std;

#define MAXN 5010
#define MAXM 5010
#define MAXP 1000000

#define in cin
#define out cout
#define dout if(true) cout

typedef int num;
#define BASE 31
#define PRIME 1000000007ll
#define RAND 3

#define MAXL 2010

num T[MAXL];
num A[MAXL];
num B[MAXL];

num pw[MAXL];
num invpw[MAXL];

num gcd(num a, num b, num& x, num& y){
	if (a==0){
		x = 0;
		y = 1;
		return b;
	}else if (b==0){
		x=1;
		y=0;
		return a;
	}else{
		num x1,y1;
		num g = gcd(b,a%b,x1,y1);

		x = y1;
		y = x1-(a/b)*y1;

		return g;
	}
}

num inv(num a){
	num x,y;
	num g = gcd(a,PRIME,x,y);
	assert(g==1);

	if (x>0) return x%PRIME;

	return (PRIME - ((-x)%PRIME))%PRIME;
}

num make_hash(string x, num* L){
	int N = x.size();
	L[0] = 0;

	for (int i=0;i<N;i++){
		L[i+1] = (L[i])%PRIME;
		L[i+1] += (((int)(x[i]-'a'+1+RAND))*pw[i])%PRIME;
		L[i+1] %= PRIME;
	}

	return L[N];
}

void calcpow()
{
	pw[0] = 1;
	invpw[0] = 1;
	for (int i=1;i<MAXL;i++){
		pw[i] = pw[i-1]*BASE;
		pw[i] %= PRIME;

		invpw[i] = inv(pw[i])%PRIME;
	}
}

num v(num*L, int i, int N){
	num ans = L[i+N] - L[i];

	if (ans < 0) ans = (PRIME - ((-ans)%PRIME))%PRIME;
	ans %= PRIME;

	ans *= invpw[i];
	ans %= PRIME;
	return ans;
}

int main(){
	string t,a,b;
	in >> t >> a >> b;

	calcpow();

	make_hash(t,T);
	num ha = make_hash(a,A);
	num hb = make_hash(b,B);

	int tlen = t.size();
	int alen = a.size();
	int blen = b.size();

	int ans = 0;

	set<num> seen;

	for (int i=0;i+alen<=tlen;i++){
		for (int j=max(i+alen-blen,i);j+blen<=tlen;j++){
			if (v(T,i,alen) == ha){
				if (v(T,j,blen) == hb){
					num vx = v(T,i,(j-i)-1+blen);
					//if (seen[vx]) continue;
					if (seen.find(vx) != seen.end()) continue;
					ans ++;
					//seen[vx] = true;
					seen.insert(vx);
				}
			}
		}
	}

	out << ans << endl;
}


#include <iostream>
#include <cmath>
#include <cassert>
#include <cstdio>
#include <ctime>
#include <queue>
#include <fstream>
#include <set>
#include <utility>
#include <map>
#include <sstream>
#include <vector>
#include <cstring>

using namespace std;

#define MAXN 5010
#define MAXM 5010
#define MAXP 1000000

#define in cin
#define out cout
#define dout if(true) cout

typedef long long num;
#define BASE 26
#define PRIME 11234567ll
#define RAND 3

#define MAXL 2010

num T[MAXL];
num A[MAXL];
num B[MAXL];

num pw[MAXL];
num invpw[MAXL];

bool seen[PRIME];

num gcd(num a, num b, num& x, num& y){
	if (a==0){
		x = 0;
		y = 1;
		return b;
	}else if (b==0){
		x=1;
		y=0;
		return a;
	}else{
		num x1,y1;
		num g = gcd(b,a%b,x1,y1);

		x = y1;
		y = x1-(a/b)*y1;

		return g;
	}
}

num inv(num a){
	num x,y;
	num g = gcd(a,PRIME,x,y);
	assert(g==1);

	if (x>0) return x%PRIME;

	return (PRIME - ((-x)%PRIME))%PRIME;
}

num make_hash(string x, num* L){
	int N = x.size();
	L[0] = 0;

	for (int i=0;i<N;i++){
		L[i+1] = (L[i])%PRIME;
		L[i+1] += (((int)(x[i]-'a'+1+RAND))*pw[i])%PRIME;
		L[i+1] %= PRIME;
	}

	return L[N];
}

void calcpow()
{
	pw[0] = 1;
	invpw[0] = 1;
	for (int i=1;i<MAXL;i++){
		pw[i] = pw[i-1]*BASE;
		pw[i] %= PRIME;

		invpw[i] = inv(pw[i])%PRIME;
	}
}

num v(num*L, int i, int N){
	num ans = L[i+N] - L[i];

	if (ans < 0) ans = (PRIME - ((-ans)%PRIME))%PRIME;
	ans %= PRIME;

	ans *= invpw[i];
	ans %= PRIME;
	return ans;
}

int main(){
	string t,a,b;
	in >> t >> a >> b;

	calcpow();

	make_hash(t,T);
	num ha = make_hash(a,A);
	num hb = make_hash(b,B);

	int tlen = t.size();
	int alen = a.size();
	int blen = b.size();

	int ans = 0;

	//set<num> seen;

	for (int i=0;i+alen<=tlen;i++){
		for (int j=max(i+alen-blen,i);j+blen<=tlen;j++){
			if (v(T,i,alen) == ha){
				if (v(T,j,blen) == hb){
					num vx = v(T,i,(j-i)-1+blen);
					if (seen[vx]) continue;
					//if (seen.find(vx) != seen.end()) continue;
					ans ++;
					//seen.insert(vx);
					seen[vx] = true;
				}
			}
		}
	}

	out << ans << endl;
}


#include <iostream>
#include <cmath>
#include <cassert>
#include <cstdio>
#include <ctime>
#include <queue>
#include <fstream>
#include <set>
#include <utility>
#include <map>
#include <sstream>
#include <vector>
#include <cstring>

using namespace std;

#define MAXN 5010
#define MAXM 5010
#define MAXP 1000000

#define in cin
#define out cout
#define dout if(true) cout

typedef long long num;
#define BASE 26
#define PRIME 111234567ll
#define RAND 3

#define MAXL 2010

num T[MAXL];
num A[MAXL];
num B[MAXL];

num pw[MAXL];
num invpw[MAXL];

bool seen[PRIME];

num gcd(num a, num b, num& x, num& y){
	if (a==0){
		x = 0;
		y = 1;
		return b;
	}else if (b==0){
		x=1;
		y=0;
		return a;
	}else{
		num x1,y1;
		num g = gcd(b,a%b,x1,y1);

		x = y1;
		y = x1-(a/b)*y1;

		return g;
	}
}

num inv(num a){
	num x,y;
	num g = gcd(a,PRIME,x,y);
	assert(g==1);

	if (x>0) return x%PRIME;

	return (PRIME - ((-x)%PRIME))%PRIME;
}

num make_hash(string x, num* L){
	int N = x.size();
	L[0] = 0;

	for (int i=0;i<N;i++){
		L[i+1] = (L[i])%PRIME;
		L[i+1] += (((int)(x[i]-'a'+1+RAND))*pw[i])%PRIME;
		L[i+1] %= PRIME;
	}

	return L[N];
}

void calcpow()
{
	pw[0] = 1;
	invpw[0] = 1;
	for (int i=1;i<MAXL;i++){
		pw[i] = pw[i-1]*BASE;
		pw[i] %= PRIME;

		invpw[i] = inv(pw[i])%PRIME;
	}
}

num v(num*L, int i, int N){
	num ans = L[i+N] - L[i];

	if (ans < 0) ans = (PRIME - ((-ans)%PRIME))%PRIME;
	ans %= PRIME;

	ans *= invpw[i];
	ans %= PRIME;
	return ans;
}

int main(){
	string t,a,b;
	in >> t >> a >> b;

	calcpow();

	make_hash(t,T);
	num ha = make_hash(a,A);
	num hb = make_hash(b,B);

	int tlen = t.size();
	int alen = a.size();
	int blen = b.size();

	int ans = 0;

	//set<num> seen;

	for (int i=0;i+alen<=tlen;i++){
		for (int j=max(i+alen-blen,i);j+blen<=tlen;j++){
			if (v(T,i,alen) == ha){
				if (v(T,j,blen) == hb){
					num vx = v(T,i,(j-i)-1+blen);
					if (seen[vx]) continue;
					//if (seen.find(vx) != seen.end()) continue;
					ans ++;
					//seen.insert(vx);
					seen[vx] = true;
				}
			}
		}
	}

	out << ans << endl;
}


#include <iostream>
#include <cmath>
#include <cassert>
#include <cstdio>
#include <ctime>
#include <queue>
#include <fstream>
#include <set>
#include <utility>
#include <map>
#include <sstream>
#include <vector>
#include <cstring>

using namespace std;

#define MAXN 5010
#define MAXM 5010
#define MAXP 1000000

#define in cin
#define out cout
#define dout if(true) cout

typedef long long num;
#define BASE 37
#define PRIME 11234567ll
#define RAND 3

#define MAXL 2010

num T[MAXL];
num A[MAXL];
num B[MAXL];

num pw[MAXL];
num invpw[MAXL];

bool seen[PRIME];

num gcd(num a, num b, num& x, num& y){
	if (a==0){
		x = 0;
		y = 1;
		return b;
	}else if (b==0){
		x=1;
		y=0;
		return a;
	}else{
		num x1,y1;
		num g = gcd(b,a%b,x1,y1);

		x = y1;
		y = x1-(a/b)*y1;

		return g;
	}
}

num inv(num a){
	num x,y;
	num g = gcd(a,PRIME,x,y);
	assert(g==1);

	if (x>0) return x%PRIME;

	return (PRIME - ((-x)%PRIME))%PRIME;
}

num make_hash(string x, num* L){
	int N = x.size();
	L[0] = 0;

	for (int i=0;i<N;i++){
		L[i+1] = (L[i])%PRIME;
		L[i+1] += (((int)(x[i]-'a'+1+RAND))*pw[i])%PRIME;
		L[i+1] %= PRIME;
	}

	return L[N];
}

void calcpow()
{
	pw[0] = 1;
	invpw[0] = 1;
	for (int i=1;i<MAXL;i++){
		pw[i] = pw[i-1]*BASE;
		pw[i] %= PRIME;

		invpw[i] = inv(pw[i])%PRIME;
	}
}

num v(num*L, int i, int N){
	num ans = L[i+N] - L[i];

	if (ans < 0) ans = (PRIME - ((-ans)%PRIME))%PRIME;
	ans %= PRIME;

	ans *= invpw[i];
	ans %= PRIME;
	return ans;
}

int main(){
	string t,a,b;
	in >> t >> a >> b;

	calcpow();

	make_hash(t,T);
	num ha = make_hash(a,A);
	num hb = make_hash(b,B);

	int tlen = t.size();
	int alen = a.size();
	int blen = b.size();

	int ans = 0;

	//set<num> seen;

	for (int i=0;i+alen<=tlen;i++){
		for (int j=max(i+alen-blen,i);j+blen<=tlen;j++){
			if (v(T,i,alen) == ha){
				if (v(T,j,blen) == hb){
					num vx = v(T,i,(j-i)-1+blen);
					if (seen[vx]) continue;
					//if (seen.find(vx) != seen.end()) continue;
					ans ++;
					//seen.insert(vx);
					seen[vx] = true;
				}
			}
		}
	}

	out << ans << endl;
}


#include <iostream>
#include <cmath>
#include <cassert>
#include <cstdio>
#include <ctime>
#include <queue>
#include <fstream>
#include <set>
#include <utility>
#include <map>
#include <sstream>
#include <vector>
#include <cstring>

using namespace std;

#define MAXN 5010
#define MAXM 5010
#define MAXP 1000000

#define in cin
#define out cout
#define dout if(true) cout

typedef long long num;
#define BASE 31
#define PRIME 11234567ll
#define RAND 3

#define MAXL 2010

num T[MAXL];
num A[MAXL];
num B[MAXL];

num pw[MAXL];
num invpw[MAXL];

bool seen[PRIME];

num gcd(num a, num b, num& x, num& y){
	if (a==0){
		x = 0;
		y = 1;
		return b;
	}else if (b==0){
		x=1;
		y=0;
		return a;
	}else{
		num x1,y1;
		num g = gcd(b,a%b,x1,y1);

		x = y1;
		y = x1-(a/b)*y1;

		return g;
	}
}

num inv(num a){
	num x,y;
	num g = gcd(a,PRIME,x,y);
	assert(g==1);

	if (x>0) return x%PRIME;

	return (PRIME - ((-x)%PRIME))%PRIME;
}

num make_hash(string x, num* L){
	int N = x.size();
	L[0] = 0;

	for (int i=0;i<N;i++){
		L[i+1] = (L[i])%PRIME;
		L[i+1] += (((int)(x[i]-'a'+1+RAND))*pw[i])%PRIME;
		L[i+1] %= PRIME;
	}

	return L[N];
}

void calcpow()
{
	pw[0] = 1;
	invpw[0] = 1;
	for (int i=1;i<MAXL;i++){
		pw[i] = pw[i-1]*BASE;
		pw[i] %= PRIME;

		invpw[i] = inv(pw[i])%PRIME;
	}
}

num v(num*L, int i, int N){
	num ans = L[i+N] - L[i];

	if (ans < 0) ans = (PRIME - ((-ans)%PRIME))%PRIME;
	ans %= PRIME;

	ans *= invpw[i];
	ans %= PRIME;
	return ans;
}

int main(){
	string t,a,b;
	in >> t >> a >> b;

	calcpow();

	make_hash(t,T);
	num ha = make_hash(a,A);
	num hb = make_hash(b,B);

	int tlen = t.size();
	int alen = a.size();
	int blen = b.size();

	int ans = 0;

	//set<num> seen;

	for (int i=0;i+alen<=tlen;i++){
		for (int j=max(i+alen-blen,i);j+blen<=tlen;j++){
			if (v(T,i,alen) == ha){
				if (v(T,j,blen) == hb){
					num vx = v(T,i,(j-i)-1+blen);
					if (seen[vx]) continue;
					//if (seen.find(vx) != seen.end()) continue;
					ans ++;
					//seen.insert(vx);
					seen[vx] = true;
				}
			}
		}
	}

	out << ans << endl;
}