#include <bits/stdc++.h>
using namespace std;
string s, b, e;
const long long p = 31, m1 = 1e9 + 7, m2 = 1e9 + 9;
vector<long long> h1, h2, p_pow1, p_pow2;
void p_pow_init() {
  p_pow1 = vector<long long>(s.size(), 1);
  p_pow2 = vector<long long>(s.size(), 1);
  for (int i = 1; i < s.size(); i++) {
    p_pow1[i] = (p_pow1[i - 1] * p) % m1;
    p_pow2[i] = (p_pow2[i - 1] * p) % m2;
  }
}
void h_init() {
  h1 = vector<long long>(s.size() + 1);
  h2 = vector<long long>(s.size() + 1);
  for (int i = 1; i <= s.size(); i++) {
    h1[i] = (h1[i - 1] + (s[i - 1] * p_pow1[i - 1]) % m1) % m1;
    h2[i] = (h2[i - 1] + (s[i - 1] * p_pow2[i - 1]) % m2) % m2;
  }
}
long long get_h1(int i, int j) {
  long long res = (h1[j + 1] - h1[i] + m1) % m1;
  return (res * p_pow1[s.size() - j - 1]) % m1;
}
long long get_h2(int i, int j) {
  long long res = (h2[j + 1] - h2[i] + m2) % m2;
  return (res * p_pow2[s.size() - j - 1]) % m2;
}
int main() {
  cin >> s >> b >> e;
  if (b.size() > s.size() || e.size() > s.size()) {
    cout << 0;
    return 0;
  }
  p_pow_init();
  h_init();
  long long bh1 = 0, eh1 = 0, bh2 = 0, eh2 = 0;
  for (int i = 0; i < b.size(); i++) bh1 = (bh1 + (b[i] * p_pow1[i]) % m1) % m1;
  for (int i = 0; i < b.size(); i++) bh2 = (bh2 + (b[i] * p_pow2[i]) % m2) % m2;
  bh1 = (bh1 * p_pow1[(s.size() - b.size())]) % m1;
  bh2 = (bh2 * p_pow2[(s.size() - b.size())]) % m2;
  for (int i = 0; i < e.size(); i++) eh1 = (eh1 + (e[i] * p_pow1[i]) % m1) % m1;
  for (int i = 0; i < e.size(); i++) eh2 = (eh2 + (e[i] * p_pow2[i]) % m2) % m2;
  eh1 = (eh1 * p_pow1[(s.size() - e.size())]) % m1;
  eh2 = (eh2 * p_pow2[(s.size() - e.size())]) % m2;
  vector<int> bs, es;
  for (int i = 0; i <= s.size() - b.size(); i++)
    if (get_h1(i, i + b.size() - 1) == bh1 &&
        get_h2(i, i + b.size() - 1) == bh2)
      bs.push_back(i);
  for (int i = 0; i <= s.size() - e.size(); i++)
    if (get_h1(i, i + e.size() - 1) == eh1 &&
        get_h2(i, i + e.size() - 1) == eh2)
      es.push_back(i);
  int ans = 0;
  for (int l = max(b.size(), e.size()); l <= s.size(); l++) {
    set<pair<long long, long long>> st;
    for (int i = 0; i <= s.size() - l; i++)
      if (get_h1(i, i + b.size() - 1) == bh1 &&
          get_h1(i + l - e.size(), i + l - 1) == eh1 &&
          get_h2(i, i + b.size() - 1) == bh2 &&
          get_h2(i + l - e.size(), i + l - 1) == eh2)
        st.insert({get_h1(i, i + l - 1), get_h2(i, i + l - 1)});
    ans += st.size();
  }
  cout << ans;
}
