#include <bits/stdc++.h>
using namespace std;
const int N = 2010;
const int P = 1e9 + 7;
const int MOD1 = 1e6 + 3;
const int MOD2 = 2e6 + 3;
struct Hash {
  int a, b;
  Hash() : a(0), b(0) {}
  Hash(long long a) : a((a + MOD1) % MOD1), b((a + MOD2) % MOD2) {}
  Hash(long long a, long long b) : a((a + MOD1) % MOD1), b((b + MOD2) % MOD2) {}
  Hash operator+(const Hash &x) const { return Hash(a + x.a, b + x.b); }
  Hash operator-(const Hash &x) const { return Hash(a - x.a, b - x.b); }
  Hash operator*(const Hash &x) const {
    return Hash(a * 1ll * x.a, b * 1ll * x.b);
  }
  bool operator<(const Hash &x) const {
    if (a != x.a) {
      return a < x.a;
    }
    return b < x.b;
  }
  bool operator==(const Hash &x) const { return a == x.a && b == x.b; }
};
int n, nb, ne;
Hash p[N];
Hash hash_t[N];
Hash hash_sb, hash_se;
char t[N], sb[N], se[N];
set<Hash> second;
bool is_prefix(int l) {
  int r = l + nb - 1;
  Hash hash = hash_t[r] - hash_t[l - 1];
  return hash_sb * p[l] == hash;
}
bool is_suffix(int r) {
  int l = r - ne + 1;
  Hash hash = hash_t[r] - hash_t[l - 1];
  return hash_se * p[l] == hash;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  p[1] = 1;
  for (int i = 2; i < N; i++) {
    p[i] = p[i - 1] * P;
  }
  cin >> (t + 1);
  n = (int)strlen(t + 1);
  for (int i = 1; i <= n; i++) {
    hash_t[i] = hash_t[i - 1] + p[i] * t[i];
  }
  cin >> (sb + 1);
  nb = (int)strlen(sb + 1);
  for (int i = 1; i <= nb; i++) {
    hash_sb = hash_sb + p[i] * sb[i];
  }
  cin >> (se + 1);
  ne = (int)strlen(se + 1);
  for (int i = 1; i <= ne; i++) {
    hash_se = hash_se + p[i] * se[i];
  }
  int res = 0;
  for (int len = max(nb, ne); len <= n; len++) {
    second.clear();
    for (int l = 1; l + len - 1 <= n; l++) {
      int r = l + len - 1;
      if (is_prefix(l) && is_suffix(r)) {
        Hash hash = (hash_t[r] - hash_t[l - 1]) * p[n - l + 1];
        second.insert(hash);
      }
    }
    res += (int)(second).size();
  }
  cout << res << "\n";
  return 0;
}
