#include <bits/stdc++.h>
const long long N = 3e3;
const long long INF = 100;
const long long OO = 1e9 + 500;
using namespace std;
string s, st, en;
unsigned long long h[N], p[N], stHash, enHash;
int stn, enn, n, ans;
vector<unsigned long long> startPoints, endPoints;
vector<unsigned long long> v;
void govnoPreCalc() {
  stn = st.size();
  enn = en.size();
  n = s.size();
  s = '#' + s;
  st = '#' + st;
  en = '#' + en;
  p[0] = 1;
}
bool check(unsigned long long kek, unsigned long long i,
           unsigned long long sz) {
  unsigned long long hash = h[i + sz - 1] - h[i - 1];
  if ((kek * p[i - 1]) == hash) {
    return true;
  } else {
    return false;
  }
}
int main() {
  ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
  ;
  cin >> s >> st >> en;
  govnoPreCalc();
  for (int i = 1; i < N; i++) {
    p[i] = p[i - 1] * 37;
  }
  for (int i = 1; i <= n; i++) {
    h[i] = (h[i - 1] + (s[i] - 'a' + 1) * p[i]);
  }
  for (int i = 1; i <= stn; i++) {
    stHash = (stHash + (st[i] - 'a' + 1) * p[i]);
  }
  for (int i = 1; i <= enn; i++) {
    enHash = (enHash + (en[i] - 'a' + 1) * p[i]);
  }
  for (int i = 1; i <= n - stn + 1; i++) {
    if (check(stHash, i, stn)) {
      startPoints.push_back(i);
    }
  }
  for (int i = 1; i <= n - enn + 1; i++) {
    if (check(enHash, i, enn)) {
      endPoints.push_back(i + enn - 1);
    }
  }
  for (int i = 0; i < endPoints.size(); i++) {
    for (int j = 0;
         j < startPoints.size() && startPoints[j] + stn - 1 <= endPoints[i];
         j++) {
      int kek = endPoints[i], lol = startPoints[j];
      if (kek - enn + 1 >= lol) {
        unsigned long long sum = h[kek] - h[lol - 1];
        sum = (sum * p[N - lol - 1]);
        v.push_back(sum);
      }
    }
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  cout << v.size();
  return 0;
}
