#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2, s3;
  long long a, b, c;
  long long p1 = 10007, p2 = 1e14 + 3;
  long long po = 1;
  cin >> s1 >> s2 >> s3;
  a = b = c = 0;
  for (int i = 0; i < s2.size(); i++) a = (a * p1 + s2[i]) % p2;
  for (int i = 0; i < s3.size(); i++) b = (b * p1 + s3[i]) % p2;
  for (int i = 1; i < s3.size(); i++) po = (po * p1) % p2;
  vector<long long> se;
  for (int i = 0; i < s1.size(); i++) {
    long long hash = 0, hash1 = 0, hash2 = 0;
    for (int j = i; j < s1.size(); j++) {
      hash = (hash * p1 + s1[j]) % p2;
      if (j - i < s2.size()) hash1 = (hash1 * p1 + s1[j]) % p2;
      if (j - i == s2.size() && hash1 != a) break;
      if (j - i < s3.size())
        hash2 = (hash2 * p1 + s1[j]) % p2;
      else {
        hash2 = ((hash2 - po * s1[j - s3.size()]) % p2 + p2) % p2;
        hash2 = (hash2 * p1 + s1[j]) % p2;
      }
      if (j - i + 1 >= s2.size() && hash1 == a && j - i + 1 >= s3.size() &&
          hash2 == b)
        se.push_back(hash);
    }
  }
  sort(se.begin(), se.end());
  se.resize(unique(se.begin(), se.end()) - se.begin());
  cout << se.size() << endl;
  return 0;
}
