#include <bits/stdc++.h>
using namespace std;
long long lhash[2001];
long long pre[2001];
long long post[2001];
long long lhash2[2001];
long long pre2[2001];
long long post2[2001];
long long pw[2001];
long long pw2[2001];
long long cash[2001];
long long cash2[2001];
long long M = 1000000009;
long long P = 1000000007;
vector<int> ss;
vector<int> ee;
vector<pair<long long, long long> > sol;
void hashit(string s, long long lhash[], long long M, long long pw[]) {
  for (int i = 0; i < s.length(); i++) {
    lhash[i] = ((s[i] - 'a' + 1) * pw[i]) % M;
    if (i != 0) {
      lhash[i] = (lhash[i] % M + lhash[i - 1] % M) % M;
    }
  }
}
long long wp(long long x, long long y, long long M) {
  if (y == 0) return 1;
  long long half = wp(x, y / 2, M);
  if (y % 2 == 0) {
    return (half * half) % M;
  } else
    return (half * half % M * x) % M;
}
long long awesomeFunction(long long *v, int i, int j, long long M,
                          long long cash[]) {
  long long ret = v[j];
  if (i > 0) ret -= v[i - 1];
  ret %= M;
  if (ret < 0) ret += M;
  ret = (ret * cash[i]) % M;
  return ret;
}
int main() {
  pw[0] = 1;
  cash[0] = 1;
  pw2[0] = 1;
  cash2[0] = 1;
  for (int i = 1; i < 2001; i++) {
    pw[i] = (pw[i - 1] * 27) % M;
    cash[i] = wp(pw[i], M - 2, M) % M;
    pw2[i] = (pw2[i - 1] * 27) % P;
    cash2[i] = wp(pw2[i], P - 2, P) % P;
  }
  string s, pref, postf;
  cin >> s >> pref >> postf;
  hashit(s, lhash, M, pw);
  hashit(pref, pre, M, pw);
  hashit(postf, post, M, pw);
  hashit(s, lhash2, P, pw2);
  hashit(pref, pre2, P, pw2);
  hashit(postf, post2, P, pw2);
  long long l, l2;
  int size = pref.length();
  for (int i = 0; i + size - 1 < s.length(); i++) {
    l = awesomeFunction(lhash, i, i + size - 1, M, cash);
    l2 = awesomeFunction(lhash2, i, i + size - 1, P, cash2);
    if (l2 == pre2[size - 1] && l == pre[size - 1]) {
      ss.push_back(i);
    }
  }
  size = postf.length();
  for (int i = 0; i + size - 1 < s.length(); i++) {
    l = awesomeFunction(lhash, i, i + size - 1, M, cash);
    l2 = awesomeFunction(lhash2, i, i + size - 1, P, cash2);
    if (l2 == post2[size - 1] && l == post[size - 1]) {
      ee.push_back(i + size - 1);
    }
  }
  for (int i = 0; i < ss.size(); i++) {
    for (int j = 0; j < ee.size(); j++) {
      if (ss[i] + pref.length() - 1 <= ee[j] &&
          ee[j] - ss[i] + 1 >= postf.length()) {
        l = awesomeFunction(lhash, ss[i], ee[j], M, cash);
        l2 = awesomeFunction(lhash2, ss[i], ee[j], P, cash2);
        sol.push_back(make_pair(l, l2));
      }
    }
  }
  sort(sol.begin(), sol.end());
  int count = 0;
  for (int i = 0; i < sol.size();) {
    long long temp = sol[i].first;
    long long temp2 = sol[i].second;
    count++;
    i++;
    while (sol[i].first == temp && sol[i].second == temp2) {
      i++;
    }
  }
  cout << count;
}
