#include <bits/stdc++.h>
using namespace std;
long long N = 500005;
long long MAX = 9223372036854775807;
long long MOD = 1000000007;
long double PI = 4 * atan(1);
long long poww[2001], poww1[2001];
struct hash_pair {
  template <class T1, class T2>
  size_t operator()(const pair<T1, T2>& p) const {
    auto hash1 = hash<T1>{}(p.first);
    auto hash2 = hash<T2>{}(p.second);
    return hash1 ^ hash2;
  }
};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cout.precision(30);
  string t, a, b;
  cin >> t >> a >> b;
  long long p = 31, mod = 1e9 + 9, p1 = 29;
  poww[0] = 1;
  poww1[0] = 1;
  for (int i = 1; i <= 2000; i++) poww[i] = (poww[i - 1] * p) % mod;
  for (int i = 1; i <= 2000; i++) poww1[i] = (poww1[i - 1] * p1) % mod;
  int n = t.length();
  unordered_map<pair<long long, long long>, long long, hash_pair> ans;
  vector<long long> pref(n + 1, 0), pref1(n + 1, 0);
  int l1 = a.length(), l2 = b.length();
  for (int i = 0; i < n; i++) {
    pref[i + 1] = (pref[i] + (t[i] - 'a' + 1) * poww[i]) % mod;
  }
  long long v1 = 0, v2 = 0;
  for (int i = 0; i < l1; i++) {
    v1 = (v1 + (a[i] - 'a' + 1) * poww[i]) % mod;
  }
  v1 = (v1 * poww[n]) % mod;
  for (int i = 0; i < l2; i++) {
    v2 = (v2 + (b[i] - 'a' + 1) * poww[i]) % mod;
  }
  v2 = (v2 * poww[n]) % mod;
  for (int i = 0; i < n; i++) {
    pref1[i + 1] = (pref1[i] + (t[i] - 'a' + 1) * poww1[i]) % mod;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      if (j + l2 - 1 <= n && i + l1 - 1 <= n && i + l1 <= j + l2) {
        long long val1 =
            (((pref[i + l1 - 1] - pref[i - 1] + mod) % mod) * poww[n - i + 1]) %
            mod;
        long long val2 =
            (((pref[j + l2 - 1] - pref[j - 1] + mod) % mod) * poww[n - j + 1]) %
            mod;
        long long val =
            (((pref[j + l2 - 1] - pref[i - 1] + mod) % mod) * poww[n - i + 1]) %
            mod;
        long long va = (((pref1[j + l2 - 1] - pref1[i - 1] + mod) % mod) *
                        poww1[n - i + 1]) %
                       mod;
        if (val1 == v1 && val2 == v2) {
          ans[{val, va}]++;
        }
      }
    }
  }
  cout << ans.size() << endl;
  return 0;
}
