#include <bits/stdc++.h>
using namespace std;
struct $ {
  $() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
  }
} $;
const int N = 200005;
struct RollingHash1 {
  static const unsigned long long p = 1000000007ULL;
  string s;
  int n;
  vector<unsigned long long> pow, phash;
  RollingHash1(string s) : s(s), n(s.length()), pow(n + 1), phash(n + 1) {
    pow[0] = 1;
    phash[0] = 0;
    for (int i = 0; i < n; i++) {
      phash[i + 1] = phash[i] * p + s[i];
      pow[i + 1] = pow[i] * p;
    }
  }
  unsigned long long getHash(int i) const { return phash[i]; }
  unsigned long long getHash(int i, int j) const {
    return getHash(j + 1) - getHash(i) * pow[j - i + 1];
  }
};
int main() {
  string s, s1, s2;
  cin >> s >> s1 >> s2;
  int n = s.length();
  int n1 = s1.length();
  int n2 = s2.length();
  RollingHash1 R(s);
  RollingHash1 R1(s1);
  RollingHash1 R2(s2);
  unsigned long long r1 = R1.getHash(0, n1 - 1);
  unsigned long long r2 = R2.getHash(0, n2 - 1);
  unordered_set<unsigned long long> S;
  for (int i = 0; i < n; i++) {
    int end1 = i + n1 - 1;
    int end2 = i + n2 - 1;
    if (end1 >= n || end2 >= n) break;
    for (int j = i; j < n; j++) {
      if (j - i + 1 < n1 || j - i + 1 < n2) continue;
      if (R.getHash(i, i + n1 - 1) == r1 && R.getHash(j - n2 + 1, j) == r2) {
        S.insert(R.getHash(i, j));
      }
    }
  }
  cout << S.size() << endl;
  return 0;
}
