#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const long long p = 3731;
const int N = 1 << 11;
const int M = N - 1;
long long deg[N];
long long h[N], h1[N], h2[N];
long long D1, D2;
vector<vector<vector<long long> > > HM;
char s[1 << 11], s1[1 << 11], s2[1 << 11];
int L, L1, L2;
bool Search(long long hash, int S) {
  for (int i = 0; i < (int)HM[S][hash & M].size(); i++)
    if (hash == HM[S][hash & M][i]) return true;
  return false;
}
int main() {
  HM.resize(N);
  for (int i = 0; i < N; i++) {
    HM[i].resize(N);
  }
  deg[0] = 1;
  for (int i = 1; i < N; i++) deg[i] = deg[i - 1] * p;
  scanf("%s", s);
  scanf("%s", s1);
  scanf("%s", s2);
  L = (int)strlen(s);
  L1 = (int)strlen(s1);
  L2 = (int)strlen(s2);
  for (int i = 0; i <= L; i++) h[i] = h[i - 1] * p + s[i - 1];
  for (int i = 0; i <= L1; i++) h1[i] = h1[i - 1] * p + s1[i - 1];
  for (int i = 0; i <= L2; i++) h2[i] = h2[i - 1] * p + s2[i - 1];
  D1 = h1[L1], D2 = h2[L2];
  int res = 0;
  for (int i = 0; i + L1 <= L; i++) {
    long long temp = h[i + L1] - deg[L1] * h[i];
    if (D1 == temp) {
      for (int j = i; j + L2 <= L; j++) {
        long long hash = h[j + L2] - deg[L2] * h[j];
        if (D2 == hash && (j + L2 >= i + L1)) {
          long long H = h[j + L2] - deg[j + L2 - i] * h[i];
          int S = j + L2 - i;
          if (!Search(H, S)) {
            res++;
            HM[S][H & M].push_back(H);
          }
        }
      }
    }
  }
  printf("%d", res);
  return 0;
}
