#include <bits/stdc++.h>
using namespace std;
const int N = 2020, P = 99973;
const unsigned long long seed = 100000009;
unsigned long long s[N], pw[N];
int n;
char str[N], b[N], e[N];
unsigned long long sb[N], se[N];
unsigned long long get(unsigned long long *ss, int l, int r) {
  return ss[r] - ss[l - 1] * pw[r - l + 1];
}
struct W {
  unsigned long long v;
  int len;
  bool operator<(const W &b) const {
    if (v != b.v) return v < b.v;
    return len < b.len;
  }
  W(){};
  W(int a, int b) : v(a), len(b){};
};
W slx[N * N / 2];
int top = 0;
int main() {
  int j, i, lb, le, l;
  s[0] = pw[0] = 1;
  scanf("%s", str + 1);
  n = strlen(str + 1);
  for (i = 1; i <= n; i++) {
    s[i] = s[i - 1] * seed + str[i];
    pw[i] = pw[i - 1] * seed;
  }
  scanf("%s", b + 1);
  scanf("%s", e + 1);
  lb = strlen(b + 1);
  le = strlen(e + 1);
  for (i = 1; i <= lb; i++) sb[i] = sb[i - 1] * seed + b[i];
  for (i = 1; i <= le; i++) se[i] = se[i - 1] * seed + e[i];
  l = max(lb, le);
  for (i = 1; i <= n; i++)
    if (get(s, i, i + lb - 1) == get(sb, 1, lb))
      for (j = i + l - 1; j <= n; j++)
        if (get(s, j - le + 1, j) == get(se, 1, le))
          slx[++top] = W(get(s, i, j), j - i + 1);
  sort(slx + 1, slx + 1 + top);
  int ans = 0;
  for (i = 1; i <= top; i++)
    if (slx[i - 1] < slx[i]) ans++;
  printf("%d", ans);
}
