#include <bits/stdc++.h>
using namespace std;
const int max_N = 2000 + 10;
const long long base[2] = {37, 53}, mod[2] = {1000003987, 1123456793};
long long hp[2], hq[2], h[2][max_N], pw[2][max_N];
vector<int> b, e;
vector<pair<int, int> > vc;
long long Hash(int o, int l, int r) {
  return (h[o][r] - (h[o][l] * pw[o][r - l]) % mod[o] + mod[o]) % mod[o];
}
int main() {
  ios::sync_with_stdio(false);
  string s, p, q;
  cin >> s >> p >> q;
  int sz = (int)s.size(), P = (int)p.size(), Q = (int)q.size();
  for (int k = 0; k < 2; k++) {
    pw[k][0] = 1;
    for (int i = 0; i < sz; i++) {
      h[k][i + 1] = ((h[k][i] * base[k]) % mod[k] + s[i]) % mod[k];
      pw[k][i + 1] = (pw[k][i] * base[k]) % mod[k];
    }
    for (char ch : p) hp[k] = ((hp[k] * base[k]) % mod[k] + ch) % mod[k];
    for (char ch : q) hq[k] = ((hq[k] * base[k]) % mod[k] + ch) % mod[k];
  }
  for (int i = 0; i < sz; i++) {
    if (i + P <= sz && Hash(0, i, i + P) == hp[0]) b.push_back(i);
    if (i + Q <= sz && Hash(0, i, i + Q) == hq[0]) e.push_back(i);
  }
  for (int l : b) {
    int i = lower_bound(e.begin(), e.end(), l) - e.begin();
    for (i; i < (int)e.size(); i++) {
      int r = e[i] + Q;
      if (r >= l + P) vc.push_back({Hash(0, l, r), Hash(1, l, r)});
    }
  }
  sort(vc.begin(), vc.end());
  vc.resize(unique(vc.begin(), vc.end()) - vc.begin());
  cout << (int)vc.size() << endl;
  return 0;
}
