#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const long long p1 = 737;
const long long p2 = 3079;
const long long m1 = 1000000123;
const long long m2 = 1000000321;
vector<long long> p_pow1(N), p_pow2(N);
pair<vector<long long>, vector<long long> > H[3];
void init() {
  p_pow1[0] = 1;
  p_pow2[0] = 1;
  for (int i = 1; i < N; i++) {
    p_pow1[i] = (p_pow1[i - 1] * p1) % m1;
    p_pow2[i] = (p_pow2[i - 1] * p2) % m2;
  }
}
pair<vector<long long>, vector<long long> > Hash(string const& s) {
  int n = s.size();
  vector<long long> h1(n + 1), h2(n + 1);
  for (int i = 0; i < n; i++) {
    h1[i + 1] = ((h1[i] * p1) % m1 + (s[i] - 'a' + 1)) % m1;
    h2[i + 1] = ((h2[i] * p2) % m2 + (s[i] - 'a' + 1)) % m2;
  }
  return {h1, h2};
}
pair<long long, long long> get_Hash(int idx, int l, int r) {
  long long x =
      (H[idx].first[r] - (H[idx].first[l - 1] * p_pow1[r - l + 1]) % m1 + m1) %
      m1;
  long long y = (H[idx].second[r] -
                 (H[idx].second[l - 1] * p_pow2[r - l + 1]) % m2 + m2) %
                m2;
  return {x, y};
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  ;
  init();
  string s, t1, t2;
  char ch[2005];
  scanf("%s", ch);
  s = ch;
  scanf("%s", ch);
  t1 = ch;
  scanf("%s", ch);
  t2 = ch;
  int n = s.size();
  int a = t1.size();
  int b = t2.size();
  H[0] = Hash(s);
  H[1] = Hash(t1);
  H[2] = Hash(t2);
  vector<pair<long long, long long> > v;
  for (int i = 1; i <= (n - a + 1); i++) {
    for (int j = i; j <= (n - b + 1); j++) {
      int len1 = i + a - 1;
      int len2 = j + b - 1;
      if (get_Hash(0, i, len1) == get_Hash(1, 1, a) &&
          get_Hash(0, j, len2) == get_Hash(2, 1, b)) {
        if (len1 <= len2) v.push_back(get_Hash(0, i, len2));
      }
    }
  }
  sort(v.begin(), v.end());
  int res = 0;
  if (v.size()) res = 1;
  for (int i = 1; i < v.size(); i++) {
    if (v[i - 1] != v[i]) res++;
  }
  printf("%d\n", res);
  return 0;
}
