#include <bits/stdc++.h>
using namespace std;
bool beg[2005];
vector<pair<long long, long long> > v;
vector<long long> en;
string t, sb, se;
long long lt, lb, le;
bool f1(long long i) {
  if (i + lb - 1 >= lt) return false;
  for (long long j = 0; j < lb; j++) {
    if (t[j + i] != sb[j]) return false;
  }
  return true;
}
bool f2(long long i) {
  if (i - le + 1 < 0) return false;
  for (long long j = 0; j < le; j++) {
    if (t[i - j] != se[le - j - 1]) {
      return false;
    }
  }
  return true;
}
int main() {
  cin >> t >> sb >> se;
  lt = t.size();
  lb = sb.size();
  le = se.size();
  for (long long i = 0; i < lt; i++) {
    beg[i] = f1(i);
  }
  for (long long i = lt - 1; i >= 0; i--) {
    if (f2(i)) {
      en.push_back(i);
    }
  }
  long long c = 0;
  for (long long i = 0; i < en.size(); i++) {
    long long a = 1, b = 1, na = 143, nb = 137;
    for (long long j = en[i] - le + 1; j >= 0; j--) {
      a = (a + t[j] * na % 1119) % 1119;
      na = na * na % 1119;
      b = (b + t[j] * nb % 154590409516822759) % 154590409516822759;
      nb = nb * nb % 154590409516822759;
      if (j + lb - 1 <= en[i] && beg[j]) {
        v.push_back(make_pair(a, b));
      }
    }
  }
  sort(v.begin(), v.end());
  c = min(1ll, (long long)v.size());
  for (int i = 1; i < v.size(); i++) {
    if (v[i] != v[i - 1]) c++;
  }
  cout << c << endl;
  return 0;
}
