#include <bits/stdc++.h>
using namespace std;
vector<int> KMP(string S, string K) {
  vector<int> T(K.size() + 1, -1);
  for (int i = 1; i <= K.size(); i++) {
    int pos = T[i - 1];
    while (pos != -1 && K[pos] != K[i - 1]) pos = T[pos];
    T[i] = pos + 1;
  }
  vector<int> matches;
  for (int sp = 0, kp = 0; sp < S.size(); sp++) {
    while (kp != -1 && (kp == K.size() || K[kp] != S[sp])) kp = T[kp];
    kp++;
    if (kp == K.size()) matches.push_back(sp + 1 - K.size());
  }
  return matches;
}
string s, p, q;
pair<long long, long long> P[2000][2000];
int main() {
  while (cin >> s >> p >> q) {
    int n = s.size();
    int A = p.size();
    int B = q.size();
    for (int i = 0; i < n; ++i) {
      long long hash1 = 0, hash2 = 0;
      for (int j = i; j < n; ++j) {
        hash1 = (hash1 * 27 + s[j] - 'a' + 1) % 1000000007LL;
        hash2 = (hash2 * 27 + s[j] - 'a' + 1) % 1000000009LL;
        P[i][j] = make_pair(hash1, hash2);
      }
    }
    vector<int> kmp1 = KMP(s, p);
    vector<int> kmp2 = KMP(s, q);
    vector<pair<long long, long long> > v;
    int a = kmp1.size();
    int b = kmp2.size();
    for (int i = 0; i < a; ++i)
      for (int j = 0; j < b; ++j)
        if (kmp2[j] >= kmp1[i] && kmp2[j] + B >= kmp1[i] + A)
          v.push_back(P[kmp1[i]][kmp2[j]]);
    sort(v.begin(), v.end());
    cout << (unique(v.begin(), v.end()) - v.begin()) << endl;
  }
}
