#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a < 0) a = -a;
  if (b < 0) b = -b;
  return b == 0 ? a : gcd(b, a % b);
}
template <typename T>
void read(T &res) {
  bool flag = false;
  char ch;
  while (!isdigit(ch = getchar())) (ch == '-') && (flag = true);
  for (res = ch - 48; isdigit(ch = getchar());
       res = (res << 1) + (res << 3) + ch - 48)
    ;
  flag && (res = -res);
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
long long qp(long long a, long long b, long long mod) {
  long long ans = 1;
  if (b == 0) {
    return ans % mod;
  }
  while (b) {
    if (b % 2 == 1) {
      b--;
      ans = ans * a % mod;
    }
    a = a * a % mod;
    b = b / 2;
  }
  return ans % mod;
}
long long qpn(long long a, long long b, long long p) {
  long long ans = 1;
  a %= p;
  while (b) {
    if (b & 1) {
      ans = (ans * a) % p;
      --b;
    }
    a = (a * a) % p;
    b >>= 1;
  }
  return ans % p;
}
string s1, s2, s3;
long long dis;
long long len1, len2, len3;
long long vis[3][100003];
vector<long long> ans;
signed main() {
  cin >> s1 >> s2 >> s3;
  len1 = s1.size();
  len2 = s2.size();
  len3 = s3.size();
  dis = max(len2, len3);
  for (long long i = 0; i < len1; i++) {
    if (s1.substr(i, len2) == s2) {
      vis[1][i] = 1;
    }
    if (s1.substr(i, len3) == s3) {
      vis[2][i + len3 - 1] = 1;
    }
  }
  for (long long i = 0; i < len1; i++) {
    if (vis[1][i]) {
      long long ve = 0;
      for (long long j = i; j < len1; j++) {
        ve = (ve * 133 + (s1[j] - 'a' + 1));
        if (vis[2][j] == 1 && j - i + 1 >= dis) {
          ans.push_back(ve);
        }
      }
    }
  }
  sort(ans.begin(), ans.end());
  ans.resize(unique(ans.begin(), ans.end()) - ans.begin());
  printf("%d", ans.size());
}
