#include <bits/stdc++.h>
using namespace std;
int Ss[10005], Ee[10005];
int pre[10005 * 200][26];
char A[10005], s[10005], e[10005];
int main() {
  scanf("%s%s%s", A, s, e);
  int n = strlen(A);
  int lens = strlen(s);
  int lene = strlen(e);
  int i, j;
  memset(Ss, 0, sizeof(Ss));
  memset(Ee, 0, sizeof(Ee));
  memset(pre, -1, sizeof(pre));
  for (i = 0; i <= n - lens; i++) {
    for (j = 0; j < lens; j++)
      if (A[i + j] != s[j]) break;
    if (j >= lens) Ss[i] = 1;
  }
  for (i = 0; i <= n - lene; i++) {
    for (j = 0; j < lene; j++)
      if (A[i + j] != e[j]) break;
    if (j >= lene) Ee[i + lene - 1] = 1;
  }
  int m = (lens > lene ? lens : lene);
  int cnt = 0;
  int alloc = 1;
  for (i = 0; i <= n - m; i++) {
    if (!Ss[i]) continue;
    int cur = 0;
    for (j = i; j < i + m - 1; j++) {
      if (pre[cur][A[j] - 'A'] == -1) pre[cur][A[j] - 'A'] = alloc++;
      cur = pre[cur][A[j] - 'A'];
    }
    for (j = i + m - 1; j < n; j++) {
      if (Ee[j])
        if (pre[cur][A[j] - 'A'] == -1) cnt++;
      if (pre[cur][A[j] - 'A'] == -1) pre[cur][A[j] - 'A'] = alloc++;
      cur = pre[cur][A[j] - 'A'];
    }
  }
  printf("%d\n", cnt);
  return 0;
}
