#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2222;
int N, M, M_Start, M_End, P[MAXN];
long long F[MAXN][MAXN], G[MAXN][MAXN];
char S[MAXN], T[MAXN];
vector<int> A, B;
int List[16777220];
long long Key[MAXN * MAXN / 2], Next[MAXN * MAXN / 2];
inline int Insert(long long A, long long B) {
  int p = A & 16777215;
  for (int i = List[p]; i; i = Next[i])
    if (Key[i] == B) return 0;
  Key[++M] = B;
  Next[M] = List[p];
  List[p] = M;
  return 1;
}
inline void KMP() {
  M = strlen(T);
  P[0] = -1;
  for (int i = 1, j = -1; i < M; i++) {
    for (; j >= 0 && T[i] != T[j + 1]; j = P[j])
      ;
    if (T[i] == T[j + 1]) j++;
    P[i] = j;
  }
  B.clear();
  for (int i = 0, j = -1; i < N; i++) {
    for (; j >= 0 && S[i] != T[j + 1]; j = P[j])
      ;
    if (S[i] == T[j + 1]) j++;
    if (j == M - 1) {
      B.push_back(i - M + 1);
    }
  }
}
int main() {
  scanf("%s", S);
  N = strlen(S);
  scanf("%s", T);
  KMP();
  M_Start = M;
  A = B;
  memset(T, 0, sizeof(T));
  scanf("%s", T);
  KMP();
  M_End = M;
  for (int i = 0; i < N; i++) {
    F[i][i] = S[i];
    G[i][i] = S[i];
    for (int j = i + 1; j < N; j++) {
      F[i][j] = F[i][j - 1] * 1000000007 + S[j];
      G[i][j] = G[i][j - 1] * 1234567891 + S[j];
    }
  }
  int Ret = 0;
  M = 0;
  for (int i = 0; i < A.size(); i++)
    for (int j = 0; j < B.size(); j++)
      if (A[i] <= B[j] && A[i] + M_Start <= B[j] + M_End) {
        int L = A[i], R = B[j] + M_End - 1;
        Ret += Insert(F[L][R], G[L][R]);
      }
  printf("%d\n", Ret);
  return 0;
}
