#include <bits/stdc++.h>
using namespace std;
int powP[2001] = {1};
int invPowP[2001] = {1};
int hashW[2001] = {0};
vector<pair<int, int> > hashTable[100003];
void findPos(string& w, string& subW, vector<int>& posSubW) {
  unsigned int j = 0, k = subW.size();
  for (unsigned int i = 0; (i + k) <= w.size(); i++) {
    while (j < subW.size() && w[i] == subW[j]) {
      i++;
      j++;
    }
    if (j == subW.size()) posSubW.push_back(i - j + 1);
    if (j > 0) {
      i -= j;
      j = 0;
    }
  }
}
void fillHash(string& w) {
  for (unsigned int i = 0; i < w.size(); i++)
    hashW[i + 1] =
        (hashW[i] + (((long long)w[i] - 96) * (long long)powP[i]) % 100003) %
        100003;
}
int myMod(int a, int m) {
  if (a >= 0) return a % m;
  return m * ((-a / m) + 1) + a;
}
int getHash(int i, int j) {
  int hashVal = myMod(hashW[j] - hashW[i - 1], 100003),
      inverse = invPowP[i - 1];
  return ((long long)hashVal * (long long)inverse) % (long long)100003;
  ;
}
inline int modPow(long long a, int b, int m) {
  long long ans = 1;
  while (b > 0) {
    if (b & 1) ans = (ans * a) % m;
    a = (a * a) % m;
    b >>= 1;
  }
  return ans;
}
int getInverse(int a, int m) { return modPow(a, m - 2, m); }
bool cmpHash(unsigned int wSize, pair<int, int>& a, pair<int, int> b) {
  unsigned int i = 0, j = wSize, mid;
  while (i < j) {
    mid = (i + j) / 2;
    if (getHash(a.first, a.first + mid) != getHash(b.first, b.first + mid))
      return false;
    else
      i = mid + 1;
  }
  return true;
}
int main() {
  vector<int> posS, posE;
  string w, s, e;
  for (unsigned int i = 1; i < 2001; i++)
    powP[i] = (((long long)powP[i - 1] * (long long)37)) % (long long)100003;
  for (unsigned int i = 1; i < 2001; i++)
    invPowP[i] = getInverse(powP[i], 100003);
  cin >> w >> s >> e;
  findPos(w, s, posS);
  findPos(w, e, posE);
  fillHash(w);
  int cont = 0, hashVal;
  bool found = false;
  for (unsigned int i = 0; i < posS.size(); i++)
    for (unsigned int j = 0; j < posE.size(); j++) {
      if (posS[i] <= posE[j] &&
          (posS[i] + s.size() - 1) <= (posE[j] + e.size() - 1)) {
        found = 0;
        hashVal = getHash(posS[i], posE[j] + e.size() - 1);
        for (unsigned int k = 0; k < hashTable[hashVal].size(); k++) {
          if ((hashTable[hashVal][k].second - hashTable[hashVal][k].first) ==
              (posE[j] - posS[i])) {
            if (cmpHash(1 + posE[j] - posS[i], hashTable[hashVal][k],
                        make_pair(posS[i], posE[j]))) {
              found = true;
              break;
            }
          }
        }
        if (!found) {
          cont++;
          hashTable[hashVal].push_back(make_pair(posS[i], posE[j]));
        }
      }
    }
  cout << cont << endl;
  return 0;
}
