#include <bits/stdc++.h>
using namespace std;
long long base[4], MOD[4] = {1000000007, 1000000009, 1000000007};
long long key[4][27];
string S, S_begin, S_end;
long long h[4][2001];
long long powers[4][2001];
long long begin_hash[4], end_hash[4];
vector<pair<pair<int, int>, int>> hashes[11588];
long long fastexp(long long b, long long exp, long long m) {
  if (exp == 0) return 1;
  long long temp = fastexp(b, exp / 2, m);
  temp = (temp * temp) % m;
  if (exp % 2 == 1) temp *= b;
  return temp % m;
}
bool isPrime(int num) {
  for (int i = 2; i * i <= num; i++)
    if (num % i == 0) return false;
  return true;
}
void generate() {
  for (int i = 0; i < 3; i++) {
    int temp;
    while (!isPrime(temp = rand() % 100 + 30))
      ;
    base[i] = temp;
  }
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 26; j++) key[i][j] = rand() % 100;
}
void precompute_powers() {
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < S.length(); j++)
      powers[i][j] = fastexp(fastexp(base[i], j, MOD[i]), MOD[i] - 2, MOD[i]);
  for (int i = 0; i < 3; i++) {
    long long b = 1;
    for (int j = 0; j < S_begin.length(); j++) {
      begin_hash[i] += key[i][S_begin[j] - 'a'] * b;
      begin_hash[i] %= MOD[i];
      b *= base[i];
      b %= MOD[i];
    }
    b = 1;
    for (int j = 0; j < S_end.length(); j++) {
      end_hash[i] += key[i][S_end[j] - 'a'] * b;
      end_hash[i] %= MOD[i];
      b *= base[i];
      b %= MOD[i];
    }
  }
}
void compute_hashes() {
  long long b;
  for (int i = 0; i < 3; i++) {
    b = 1;
    for (int j = 0; j < S.length(); j++) {
      h[i][j] = key[i][S[j] - 'a'] * b;
      if (j != 0) h[i][j] += h[i][j - 1];
      h[i][j] %= MOD[i];
      b *= base[i];
      b %= MOD[i];
    }
  }
}
long long get_hash(int start, int end, int mode) {
  if (start == 0) return h[mode][end];
  long long temp =
      (h[mode][end] + MOD[mode] - h[mode][start - 1]) * powers[mode][start];
  return temp % MOD[mode];
}
bool check(int start, int end) {
  for (int i = 0; i < 3; i++) {
    if (get_hash(start, start + S_begin.length() - 1, i) != begin_hash[i])
      return false;
    if (get_hash(end - S_end.length() + 1, end, i) != end_hash[i]) return false;
  }
  return true;
}
int main() {
  srand(time(NULL));
  cin >> S >> S_begin >> S_end;
  if ((int)S_begin.length() > (int)S.length() ||
      (int)S_end.length() > (int)S.length()) {
    cout << 0 << endl;
    return 0;
  }
  generate();
  precompute_powers();
  compute_hashes();
  for (int i = 0; i < S.length(); i++) {
    for (int j = i + max((int)S_begin.length(), (int)S_end.length()) - 1;
         j < S.length(); j++) {
      long long val[4];
      for (int k = 0; k < 3; k++) val[k] = get_hash(i, j, k);
      if (check(i, j)) {
        long long new_hash = (val[0] + (val[1] * 9769) % 1000000007 +
                              (val[2] * 9769 * 9769) % 1000000007) %
                             1000000007;
        new_hash %= 11588;
        hashes[new_hash].push_back(
            make_pair(make_pair(val[0], val[1]), val[2]));
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < 11588; i++) {
    sort(hashes[i].begin(), hashes[i].end());
    int temp = 0;
    if (hashes[i].size() > 0) temp = 1;
    for (int j = 1; j < hashes[i].size(); j++)
      if (hashes[i][j] != hashes[i][j - 1]) temp++;
    ans += temp;
  }
  cout << ans << endl;
  return 0;
}
