#include <bits/stdc++.h>
using namespace std;
const int M1 = 1000000007, M2 = 1000000009;
int HT1[2000][2000], HT2[2000][2000];
int main() {
  string s, a, b;
  cin >> s >> a >> b;
  int n = s.size();
  for (int i = 0; i < n; ++i)
    for (int j = i; j < n; ++j) {
      if (!j) {
        HT1[i][j] = (s[j] - 'a') + 1;
        HT2[i][j] = (s[j] - 'a') + 1;
      } else {
        HT1[i][j] = (HT1[i][j - 1] * 27ll + (s[j] - 'a' + 1)) % M1;
        HT2[i][j] = (HT2[i][j - 1] * 27ll + (s[j] - 'a' + 1)) % M2;
      }
    }
  int A1 = 0, A2 = 0, B1 = 0, B2 = 0;
  n = a.size();
  for (int i = 0; i < n; ++i) {
    A1 = (A1 * 27ll + (a[i] - 'a') + 1) % M1;
    A2 = (A2 * 27ll + (a[i] - 'a') + 1) % M2;
  }
  n = b.size();
  for (int i = 0; i < n; ++i) {
    B1 = (B1 * 27ll + (b[i] - 'a') + 1) % M1;
    B2 = (B2 * 27ll + (b[i] - 'a') + 1) % M2;
  }
  vector<pair<int, int> > v;
  int as = a.size(), bs = max(b.size(), a.size()) - 1;
  n = s.size();
  for (int i = 0; i + as - 1 < n; ++i) {
    for (int j = i + bs; j < n; ++j) {
      int k = i + as - 1;
      int l = j - b.size() + 1;
      int h1 = HT1[i][k], h2 = HT2[i][k];
      int h3 = HT1[l][j], h4 = HT2[l][j];
      if (h1 == A1 && h2 == A2 && h3 == B1 && h4 == B2)
        v.push_back(make_pair(HT1[i][j], HT2[i][j]));
    }
  }
  sort(v.begin(), v.end());
  v.resize(unique(v.begin(), v.end()) - v.begin());
  printf("%d\n", int(v.size()));
  return 0;
}
