#include <bits/stdc++.h>
using namespace std;
double eps = (double)1 / 1e15;
long long inf = 1e18, mod2 = 998244353, mod1 = 1e9 + 9;
long long sqr(long long a) { return a * a; }
long long qb(long long a) { return a * a * a; }
long long gcd(long long a, long long b) { return !a ? b : gcd(b % a, a); }
long long binpow(long long a, long long b, long long mod) {
  return b ? (b % 2 ? (a * (sqr(binpow(a, b / 2, mod)) % mod)) % mod
                    : sqr(binpow(a, b / 2, mod)) % mod)
           : 1;
}
long long binmult(long long a, long long b, long long mod) {
  return b ? (b % 2 ? (2 * binmult(a, b / 2, mod) + a) % mod
                    : (2 * binmult(a, b / 2, mod)) % mod)
           : 0;
}
const long long N = 2 * 1e3 + 1;
const long long R = 1e4;
const long long to[7] = {1, 2, 3, 1, 3, 2, 1};
const long long pr = 29;
signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  ;
  string a, b, c;
  cin >> a >> b >> c;
  vector<long long> p1(2001), p2(2001);
  p1[0] = 1, p2[0] = 1;
  for (long long i = 1; i < (int)p1.size(); i++) {
    p1[i] = (p1[i - 1] * pr) % mod1;
    p2[i] = (p2[i - 1] * pr) % mod2;
  }
  vector<long long> h1((long long)a.size());
  long long n = (long long)a.size();
  h1[0] = a[0] - 'a' + 1;
  for (long long i = 1; i < n; i++) {
    h1[i] = (h1[i - 1] + ((a[i] - 'a' + 1) * p1[i]) % mod1) % mod1;
  }
  long long c1 = 0, c2 = 0;
  long long d1 = 0, d2 = 0;
  for (long long i = 0; i < (long long)b.size(); i++) {
    c1 += (p1[i] * (b[i] - 'a' + 1)) % mod1;
    c1 %= mod1;
  }
  for (long long i = 0; i < (long long)c.size(); i++) {
    d1 += (p1[i] * (c[i] - 'a' + 1)) % mod1;
    d1 %= mod1;
  }
  long long mx = max((long long)b.size() - 1, (long long)c.size() - 1);
  map<long long, set<long long>> mp;
  for (long long i = 0; i < n; i++) {
    for (long long j = i + mx; j < n; j++) {
      long long need1 = h1[i + (long long)b.size() - 1];
      long long need3 = h1[j];
      if (i) {
        need1 -= h1[i - 1];
        need1 += mod1;
        need1 %= mod1;
      }
      if (j - (long long)c.size() >= 0) {
        need3 -= h1[j - (long long)c.size()];
        need3 += mod1;
        need3 %= mod1;
      }
      long long cc1 = c1, cc2 = c2;
      long long dd1 = d1, dd2 = d2;
      cc1 *= p1[i];
      cc1 %= mod1;
      dd1 *= p1[j - (long long)c.size() + 1];
      dd1 %= mod1;
      if (cc1 == need1 && dd1 == need3) {
        long long ps1 = h1[j];
        if (i) ps1 -= h1[i - 1];
        ps1 += mod1;
        ps1 %= mod1;
        ps1 *= p1[(long long)a.size() - i - 1];
        ps1 %= mod1;
        mp[j - i + 1].insert(ps1);
      }
    }
  }
  long long ans = 0;
  for (auto u : mp) {
    ans += (int)u.second.size();
  }
  cout << ans;
}
