#include <bits/stdc++.h>
using namespace std;
const long long p = 51;
vector<long long> pref_hash;
vector<long long> p_step;
int main() {
  vector<set<long long> > res;
  string s, sb, se;
  cin >> s >> sb >> se;
  if (s.length() < sb.length() || s.length() < se.length()) {
    cout << 0 << endl;
    return 0;
  }
  res.resize(s.length());
  pref_hash.resize(s.length());
  p_step.resize(s.length());
  long long step = 1;
  pref_hash[0] = (s[0] - 'a' + 1);
  p_step[0] = 1;
  for (int i = 1; i < s.length(); i++) {
    step *= p;
    p_step[i] = step;
    pref_hash[i] = step * (s[i] - 'a' + 1) + pref_hash[i - 1];
  }
  long long hb = 0;
  for (int i = 0; i < sb.length(); i++) {
    hb += (sb[i] - 'a' + 1) * p_step[i];
  }
  long long he = 0;
  for (int j = 0; j < se.length(); j++) {
    he += (se[j] - 'a' + 1) * p_step[j];
  }
  for (int i = 0; i < s.length(); i++) {
    for (int j = (max(sb.length(), se.length())); i + j - 1 < s.length(); j++) {
      long long buf = pref_hash[i + sb.length() - 1],
                buf1 = i != 0 ? pref_hash[i - 1] : 0;
      long long curr_hb = buf - buf1;
      buf = pref_hash[i + j - 1];
      buf1 = (i + j - se.length()) ? pref_hash[i + j - se.length() - 1] : 0;
      long long curr_he = buf - buf1;
      buf = pref_hash[i + j - 1];
      buf1 = i != 0 ? pref_hash[i - 1] : 0;
      if (curr_hb == hb * p_step[i] &&
          curr_he == he * p_step[i + j - se.length()])
        res[j - 1].insert((buf - buf1) * p_step[s.length() - i - 1]);
    }
  }
  long long res_count = 0;
  for (int i = 0; i < s.length(); i++) res_count += res[i].size();
  cout << res_count << endl;
  return 0;
}
