#include <bits/stdc++.h>
using namespace std;
bool vs[(2005)], vt[(2005)];
int ng, ns, nt, ans, tot;
int p[(2005)];
int G[(2005) * (2005) / 2][26];
bool flag[(2005) * (2005) / 2];
void KMP(string a, string b, bool* vis, int typ) {
  int k, na = a.size(), nb = b.size();
  p[0] = -1, k = -1;
  for (int i = 1; i < na; ++i) {
    while (k != -1 && a[k + 1] != a[i]) k = p[k];
    if (a[k + 1] == a[i]) k++;
    p[i] = k;
  }
  k = -1;
  for (int i = 0; i < nb; ++i) {
    while (k != -1 && a[k + 1] != b[i]) k = p[k];
    if (a[k + 1] == b[i]) k++;
    if (k == na - 1) {
      if (typ == 0)
        vis[i - k] = true;
      else
        vis[i] = true;
    }
  }
}
int main() {
  string g, s, t;
  cin >> g >> s >> t;
  ng = g.size(), ns = s.size(), nt = t.size();
  KMP(s, g, vs, 0);
  memset(p, 0, sizeof(p));
  KMP(t, g, vt, 1);
  tot = 1;
  for (int i = 0; i < ng; ++i) {
    if (!vs[i]) continue;
    int k = 1;
    for (int j = i; j < ng; ++j) {
      int now = g[j] - 'a';
      if (G[k][now] == 0) G[k][now] = ++tot;
      k = G[k][now];
      if (vt[j] && j - i + 1 >= ns && j - i + 1 >= nt) {
        if (!flag[k]) flag[k] = true, ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
