#include <bits/stdc++.h>
using namespace std;
vector<long long unsigned> p_pow;
vector<long long unsigned> reverse_p_pow;
const int hash_base = 31;
long long unsigned binpow(long long unsigned a, long long unsigned n) {
  long long res = 1;
  while (n) {
    if (n & 1) res *= a;
    a *= a;
    n >>= 1;
  }
  return res;
};
const long long unsigned MAX_DEGREE = binpow(2, 63) - 1;
vector<long long unsigned> init_p_pow(int length_of_vector) {
  vector<long long unsigned> res(length_of_vector);
  long long unsigned p_pow = (long long unsigned)hash_base;
  res[0] = 1;
  for (size_t i = 1; i < length_of_vector; i++)
    if (i) res[i] = res[i - 1] * p_pow;
  return res;
}
vector<long long unsigned> init_reverse_p_pow(
    vector<long long unsigned> p_pow) {
  vector<long long unsigned> result(p_pow.size());
  int l = p_pow.size();
  for (int i = 0; i < l; i++) result[i] = binpow(p_pow[i], MAX_DEGREE);
  return result;
};
vector<int> zfunction(string s) {
  int n = s.length();
  vector<int> z(n, 0);
  for (int i = 1, l = 0, r = 0; i < n; i++) {
    if (i <= r) z[i] = min(r - i + 1, z[i - l]);
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
  return z;
}
pair<string, vector<long long unsigned> > getHashes(string s) {
  if (p_pow.size() == 0) p_pow = init_p_pow(2000);
  if (reverse_p_pow.size() == 0) reverse_p_pow = init_reverse_p_pow(p_pow);
  vector<long long unsigned> result(s.length());
  int l = s.length();
  for (int i = 0; i < l; i++) {
    result[i] = (s[i] - 'a' + 1) * p_pow[i];
    if (i) result[i] += result[i - 1];
  }
  return make_pair(s, result);
}
inline long long unsigned get_hash_substr(
    pair<string, vector<long long unsigned> > h, int i, int j) {
  long long unsigned res = 0;
  res = h.second[j];
  if (i) res -= h.second[i - 1];
  res *= reverse_p_pow[i];
  return res;
}
int main() {
  string t, a, b;
  cin >> t >> a >> b;
  vector<int> za = zfunction(a + "#" + t);
  vector<int> zb = zfunction(b + "#" + t);
  vector<int> ia(t.length(), 0);
  vector<int> ib(t.length(), 0);
  int la = a.length();
  int lb = b.length();
  int lt = t.length();
  pair<string, vector<long long unsigned> > t_hash = getHashes(t),
                                            a_hash = getHashes(a),
                                            b_hash = getHashes(b);
  int intersection = 0;
  int i1 = la - 1;
  int j2 = 0;
  int count = 1;
  int mi = min(la, lb);
  bool f = false;
  long long unsigned ha, hb;
  long long unsigned q = reverse_p_pow[0];
  while (count <= mi) {
    f = false;
    ha = a_hash.second[la - 1];
    if (i1) ha -= a_hash.second[i1 - 1];
    ha *= reverse_p_pow[i1];
    hb = b_hash.second[j2];
    hb *= q;
    f = (ha == hb);
    if (f)
      if (count > intersection) intersection = count;
    i1--;
    j2++;
    count++;
  }
  long long unsigned *answer = new long long unsigned[2001000];
  int len_ans = 0;
  int c1 = 0, c2 = 0;
  for (int i = 0; i < lt; i++) {
    if (za[la + 1 + i] == la)
      ia[i] = 1;
    else
      c1++;
    if (zb[lb + 1 + i] == lb)
      ib[i] = 1;
    else
      c2++;
  }
  if (c2 + c1 == 2 * lt) {
    cout << 0;
    return 0;
  }
  if (ia[0]) {
    for (int j = la - intersection; j < lt; j++) {
      if (ib[j]) {
        long long unsigned h = t_hash.second[j + lb - 1];
        h *= reverse_p_pow[0];
        answer[len_ans] = h;
        len_ans++;
      }
    }
  }
  for (int i = 1; i < lt; i++) {
    if (ia[i]) {
      for (int j = i + la - intersection; j < lt; j++) {
        if (ib[j]) {
          long long unsigned h = t_hash.second[j + lb - 1];
          h -= t_hash.second[i - 1];
          h *= reverse_p_pow[i];
          answer[len_ans] = h;
          len_ans++;
        }
      }
    }
  }
  sort(answer, answer + len_ans);
  int ans_count = 0;
  for (int i = 0; i < len_ans - 1; i++) {
    if (answer[i] != answer[i + 1]) ans_count++;
  }
  if (len_ans) ans_count++;
  cout << ans_count;
  return 0;
}
