#include <bits/stdc++.h>
using namespace std;
void my_dbg() { cout << endl; }
template <typename Arg, typename... Args>
void my_dbg(Arg A, Args... B) {
  cout << ' ' << A;
  my_dbg(B...);
}
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
const int inf = INT_MAX;
const int ninf = INT_MIN;
const int maxN = 2e3 + 2;
vl p = {29, 31}, mod = {(ll)1e9 + 7, (ll)1e9 + 9};
vector<vl> pre(2, vl(maxN)), suf(2, vl(maxN));
ll pwr[2][maxN], inv_pwr[2][maxN];
ll me(ll x, ll n, ll mod) {
  ll res = 1;
  while (n) {
    if (n & 1) res = (res * x) % mod;
    n >>= 1;
    x = (x * x) % mod;
  }
  return res;
}
ll mi(ll x, ll mod) { return me(x, mod - 2, mod); }
void preprocess() {
  for (int kind = 0; kind < (int)2; kind++) {
    pwr[kind][0] = 1;
    for (int i = 1; i < (int)maxN; i++) {
      pwr[kind][i] = (p[kind] * pwr[kind][i - 1]) % mod[kind];
    }
    inv_pwr[kind][maxN - 1] = mi(pwr[kind][maxN - 1], mod[kind]);
    for (int i = maxN - 1; i > 0; i--) {
      inv_pwr[kind][i - 1] = (p[kind] * inv_pwr[kind][i]) % mod[kind];
    }
  }
}
void compute_hash(string s, vector<vl>& preh, vector<vl>& sufh) {
  int n = (int)s.size();
  for (int kind = 0; kind < (int)2; kind++) {
    for (int i = 0; i < (int)n; i++) {
      preh[kind][i] = (pwr[kind][i] * (s[i] - 'a' + 1)) % mod[kind];
      if (i > 0)
        preh[kind][i] = (preh[kind][i] + preh[kind][i - 1]) % mod[kind];
    }
    for (int i = n - 1; i >= 0; i--) {
      sufh[kind][i] = (pwr[kind][n - 1 - i] * (s[i] - 'a' + 1)) % mod[kind];
      if (i > 0)
        sufh[kind][i] = (sufh[kind][i] + sufh[kind][i + 1]) % mod[kind];
    }
  }
}
pair<ll, ll> get_hash(int l, int r) {
  pair<ll, ll> pp = {0, 0};
  for (int kind = 0; kind < (int)2; kind++) {
    ll hash;
    hash = pre[kind][r];
    if (l > 0) hash = (hash - pre[kind][l - 1] + mod[kind]) % mod[kind];
    hash = (hash * inv_pwr[kind][l]) % mod[kind];
    if (kind == 0)
      pp.first = hash;
    else
      pp.second = hash;
  }
  return pp;
}
void solve() {
  string s, st, nd;
  cin >> s >> st >> nd;
  int n = (int)s.size(), m = (int)st.size(), k = (int)nd.size();
  preprocess();
  compute_hash(s, pre, suf);
  vi canBegin(n, 0), canEnd(n, 0);
  for (int i = 0; i + m <= n; i++) {
    string util = s.substr(i, m);
    if (util == st) {
      canBegin[i] = 1;
    }
  }
  for (int i = 0; i + k <= n; i++) {
    string util = s.substr(i, k);
    if (util == nd) {
      canEnd[i + k - 1] = 1;
    }
  }
  vector<pair<ll, ll>> v;
  for (int i = 0; i < n; i++) {
    for (int j = i + max(m, k) - 1; j < n; j++) {
      if (canBegin[i] and canEnd[j]) {
        auto util = get_hash(i, j);
        v.push_back(util);
      }
    }
  }
  sort(v.begin(), v.end());
  int ans = unique(v.begin(), v.end()) - v.begin();
  printf("%d\n", (int)(ans));
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
