#include <bits/stdc++.h>
using namespace std;
const long long INF = 1 << 28;
const long long LINF = 1ll << 61;
inline long long getnum() {
  register long long r = 0;
  register bool ng = 0;
  register char c;
  c = getchar();
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  if (c == '-') ng = 1, c = getchar();
  while (c != ' ' && c != '\n') r = r * 10 + c - '0', c = getchar();
  if (ng) r = -r;
  return r;
}
template <class T>
inline void putnum(T x) {
  if (x < 0) putchar('-'), x = -x;
  register short a[20] = {}, sz = 0;
  while (x > 0) a[sz++] = x % 10, x /= 10;
  if (sz == 0) putchar('0');
  for (int i = sz - 1; i >= 0; i--) putchar('0' + a[i]);
}
inline void putsp() { putchar(' '); }
inline void putendl() { putchar('\n'); }
inline char mygetchar() {
  register char c = getchar();
  while (c == ' ' || c == '\n') c = getchar();
  return c;
}
char s[2011], sb[2011], se[2011];
bool fb[2011], fe[2011];
int n, nb, ne, sum[2011];
int sa[2011], rk[2011], tmp[2011], K, lcp[2011];
bool comp(int i, int j) {
  return make_pair(rk[i], i + K < n ? rk[i + K] : -1) <
         make_pair(rk[j], j + K < n ? rk[j + K] : -1);
}
void construct_sa() {
  for (int i = 0; i < n; i++) sa[i] = i, rk[i] = s[i];
  for (K = 1; K < n; K *= 2) {
    sort(sa, sa + n, comp);
    tmp[0] = 1;
    for (int i = 1; i < n; i++) tmp[i] = tmp[i - 1] + comp(sa[i - 1], sa[i]);
    for (int i = 0; i < n; i++) rk[sa[i]] = tmp[i];
  }
  for (int i = 0; i < n; i++) rk[sa[i]] = i;
  int h = 0;
  for (int i = 0; i < n; i++) {
    int x = sa[rk[i]];
    if (h > 0) h--;
    if (rk[i] == 0) continue;
    int y = sa[rk[i] - 1];
    while (x + h < n && y + h < n && s[x + h] == s[y + h]) h++;
    lcp[rk[i]] = h;
  }
}
int mx[2011];
int main() {
  scanf("%s%s%s", s, sb, se);
  n = strlen(s);
  nb = strlen(sb);
  ne = strlen(se);
  for (int i = 0; i + nb <= n; i++) {
    bool ok = 1;
    for (int j = 0; j < nb; j++) {
      if (s[i + j] != sb[j]) {
        ok = 0;
        break;
      }
    }
    if (ok) fb[i] = 1;
  }
  for (int i = 0; i + ne <= n; i++) {
    bool ok = 1;
    for (int j = 0; j < ne; j++) {
      if (s[i + j] != se[j]) {
        ok = 0;
        break;
      }
    }
    if (ok) fe[i + ne] = 1;
  }
  sum[0] = fe[0];
  for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + fe[i];
  construct_sa();
  for (int i = 0; i < n; i++)
    mx[sa[i]] = min(n, max(sa[i] + max(nb, ne) - 1, sa[i] + lcp[i]));
  int tot = 0;
  for (int i = 0; i < n; i++) {
    if (!fb[i]) continue;
    tot += sum[n] - sum[mx[i]];
  }
  cout << tot << endl;
  return 0;
}
