#include <bits/stdc++.h>
using namespace std;
const int N = 2004;
unsigned long long pw[N], hs[N], f = 0, g = 0;
char s[N], t[N], u[N];
bool a[N], b[N];
int ls, lt, lu;
unordered_set<unsigned long long> st;
unsigned long long geths(int l, int r) {
  return hs[r] - hs[l - 1] * pw[r - l + 1];
}
int main() {
  scanf("%s %s %s", s + 1, t + 1, u + 1);
  ls = strlen(s + 1);
  lt = strlen(t + 1);
  lu = strlen(u + 1);
  pw[0] = 1;
  for (int i = 1; i <= ls; i++) {
    hs[i] = hs[i - 1] * 137 + s[i];
    pw[i] = pw[i - 1] * 137;
  }
  for (int i = 1; i <= lt; i++) f = f * 137 + t[i];
  for (int j = 1; j <= lu; j++) g = g * 137 + u[j];
  for (int i = lu; i <= ls; i++)
    if (geths(i - lu + 1, i) == g) b[i] = 1;
  for (int j = lt; j <= ls; j++)
    if (geths(j - lt + 1, j) == f) a[j] = 1;
  for (int i = lu; i <= ls; i++)
    if (b[i])
      for (int j = lt; j <= i && j - lt <= i - lu; j++)
        if (a[j]) st.insert(geths(j - lt + 1, i));
  printf("%d\n", st.size());
}
