#include <bits/stdc++.h>
using namespace std;
template <typename T>
T in() {
  char ch;
  T n = 0;
  bool ng = false;
  while (1) {
    ch = getchar();
    if (ch == '-') {
      ng = true;
      ch = getchar();
      break;
    }
    if (ch >= '0' && ch <= '9') break;
  }
  while (1) {
    n = n * 10 + (ch - '0');
    ch = getchar();
    if (ch < '0' || ch > '9') break;
  }
  return (ng ? -n : n);
}
template <typename T>
inline T POW(T B, T P) {
  if (P == 0) return 1;
  if (P & 1)
    return B * POW(B, P - 1);
  else
    return (POW(B, P / 2) * POW(B, P / 2));
}
template <typename T>
inline T Gcd(T a, T b) {
  if (a < 0) return Gcd(-a, b);
  if (b < 0) return Gcd(a, -b);
  return (b == 0) ? a : Gcd(b, a % b);
}
template <typename T>
inline T Lcm(T a, T b) {
  if (a < 0) return Lcm(-a, b);
  if (b < 0) return Lcm(a, -b);
  return a * (b / Gcd(a, b));
}
long long Bigmod(long long base, long long power, long long MOD) {
  long long ret = 1;
  while (power) {
    if (power & 1) ret = (ret * base) % MOD;
    base = (base * base) % MOD;
    power >>= 1;
  }
  return ret;
}
bool isVowel(char ch) {
  ch = toupper(ch);
  if (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E')
    return true;
  return false;
}
long long ModInverse(long long number, long long MOD) {
  return Bigmod(number, MOD - 2, MOD);
}
bool isConst(char ch) {
  if (isalpha(ch) && !isVowel(ch)) return true;
  return false;
}
int toInt(string s) {
  int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
unsigned long long int B1[2007];
void Init() {
  B1[0] = 1;
  for (int i = 1; i < 2007; i++) {
    B1[i] = B1[i - 1] * 10000019ULL;
  }
}
unsigned long long int H[2007];
struct Hash {
  int L;
  Hash() { L = 0, H[0] = 0; }
  void Insert(char x) {
    int digit = x - 'a' + 1;
    L++;
    H[L] = H[L - 1] * 10000019ULL + digit;
  }
  unsigned long long int SubStr(int l, int r) {
    int len = r - l + 1;
    unsigned long long int ans;
    ans = H[r] - H[l - 1] * B1[len];
    return ans;
  }
};
int n, m, k;
map<unsigned long long int, bool> mp;
bool Ok[2007];
char a[2007], b[2007], c[2007];
int L;
unsigned long long int A[2007 * 2007 + 10];
int main() {
  Init();
  gets(a);
  gets(b);
  gets(c);
  n = strlen(a), m = strlen(b), k = strlen(c);
  Hash h = Hash();
  for (int i = 1; i <= m; i++) {
    h.Insert(b[i - 1]);
  }
  unsigned long long int x = H[m];
  h = Hash();
  for (int i = 1; i <= k; i++) {
    h.Insert(c[i - 1]);
  }
  unsigned long long int y = H[k];
  h = Hash();
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    h.Insert(a[i - 1]);
    if (i >= m) {
      if (h.SubStr(i - m + 1, i) == x) Ok[i - m + 1] = true;
    }
    if (i >= k) {
      if (h.SubStr(i - k + 1, i) == y) {
        for (int j = 1; j <= i; j++) {
          if (!Ok[j]) continue;
          if (i - j + 1 < max(m, k)) break;
          unsigned long long int X = h.SubStr(j, i);
          A[L++] = X;
        }
      }
    }
  }
  sort(A, A + L);
  if (L) ans = 1;
  for (int i = 1; i < L; i++) {
    if (A[i] != A[i - 1]) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
