#include <bits/stdc++.h>
using namespace std;
int inf = 1000000005;
long long int llinf = 4000000000000000005LL;
int mod = 1000000007;
int mod9 = 1000000009;
double pi = 3.1415926535897;
double eps = 1e-15;
int dx[] = {1, 1, -1, -1};
int dy[] = {1, -1, 1, -1};
vector<bool> isprime;
set<int> primes;
void seive(int n, bool wantlist = true) {
  isprime.resize(n + 1, true);
  isprime[0] = isprime[1] = false;
  int sq = sqrt(n + 1);
  for (int i = 2; i < sq + 1; i++) {
    if (isprime[i]) {
      for (int j = i * i; j <= n; j += i) isprime[j] = false;
    }
  }
  for (int i = 2; wantlist && i <= n; i++) {
    if (isprime[i]) primes.insert(i);
  }
}
template <class T>
inline T gcd(T a, T b) {
  while (b > 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}
template <class T>
inline T lcm(T a, T b) {
  return a * b / gcd(a, b);
}
template <class T>
inline vector<T> operator+(vector<T>& a, vector<T>& b) {
  assert(a.size() == b.size());
  int n = a.size();
  vector<T> c(n);
  for (int i = 0; i < n; i++) c[i] = a[i] + b[i];
  return c;
}
inline long long int bexp(long long int x, long long int n) {
  long long int res = 1;
  x %= mod;
  while (n) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
inline bool ispalin(string& str) {
  int n = str.length();
  for (int i = 0; i < n / 2; i++)
    if (str[i] != str[n - i - 1]) return false;
  return true;
}
inline int digsum(int n) {
  int res = 0;
  while (n > 0) {
    res += n % 10;
    n /= 10;
  }
  return res;
}
int main() {
  string t, s, e;
  cin >> t >> s >> e;
  int nt = t.length(), ns = s.length(), ne = e.length();
  vector<bool> st(nt), en(nt);
  for (int i = 0; i < nt - ns + 1; i++) {
    st[i] = true;
    for (int j = 0; j < ns; j++) st[i] = st[i] && s[j] == t[i + j];
  }
  for (int i = 0; i < nt - ne + 1; i++) {
    bool b = true;
    for (int j = 0; j < ne; j++) b = b && t[i + j] == e[j];
    en[i + ne - 1] = b;
  }
  unordered_set<long long int> uniq;
  vector<long long int> p(nt);
  p[0] = 1;
  for (int i = 1; i < nt; i++) p[i] = 31 * p[i - 1] % mod;
  for (int i = 0; i < nt; i++) {
    if (st[i]) {
      long long int has = 0;
      for (int j = i; j < nt; j++) {
        has = 31 * has + (t[j] - 'a' + 1);
        if (en[j] && j - i + 1 >= max(ns, ne)) uniq.insert(has);
      }
    }
  }
  cout << uniq.size() << endl;
}
