#include <bits/stdc++.h>
using namespace std;
int n;
string t, s, e;
vector<int> starts, fucks;
unordered_map<long long, int> m[2009];
int main() {
  cin >> t >> s >> e;
  int itr = 0;
  int sz = t.size();
  int tsz = e.size();
  for (; itr < sz;) {
    int pos = t.find(s, itr);
    if (pos == string::npos) {
      break;
    }
    itr = pos + 1;
    starts.push_back(pos);
  }
  itr = 0;
  for (; itr < sz;) {
    int pos = t.find(e, itr);
    if (pos == string::npos) {
      break;
    }
    itr = pos + 1;
    fucks.push_back(pos + tsz - 1);
  }
  if (fucks.empty()) {
    cout << 0 << endl;
    return 0;
  }
  long long rol = 0;
  long long ret = 0;
  int mxlen = max(s.size(), e.size());
  for (typeof(starts.begin()) it = (starts.begin()); it != starts.end(); it++) {
    int pos = *it, temp;
    typeof(fucks.begin()) itr = (fucks.begin());
    itr = lower_bound(fucks.begin(), fucks.end(), pos);
    rol = 0;
    int cur = pos;
    while (itr != fucks.end()) {
      temp = (*itr) - tsz + 1;
      int len = (*itr) - pos + 1;
      if (temp < pos || len < mxlen) {
        itr++;
        continue;
      }
      while (cur <= (*itr)) {
        rol = (rol * (111181111) + (t[cur] - 'a' + 1)) % (9999999900000001L);
        cur++;
      }
      if (m[len][rol] == 0) {
        ret++;
        m[len][rol] = 1;
      }
      itr++;
    }
  }
  cout << ret << endl;
}
