#include <bits/stdc++.h>
using namespace std;
const int N = 2000 + 5;
int n, m1, m2, ans = 0, lcp[N][N], d1[N][N], d2[N][N];
char S[N], bg[N], ed[N];
int main() {
  scanf("%s\n%s\n%s", S, bg, ed);
  n = strlen(S), m1 = strlen(bg), m2 = strlen(ed);
  memset(lcp, 0, sizeof(lcp));
  memset(d1, 0, sizeof(d1));
  memset(d2, 0, sizeof(d2));
  for (int i = n - 1; i >= 0; i--)
    for (int j = n - 1; j >= 0; j--)
      lcp[i][j] = S[i] == S[j] ? lcp[i + 1][j + 1] + 1 : 0;
  for (int i = n - 1; i >= 0; i--)
    for (int j = m1 - 1; j >= 0; j--)
      d1[i][j] = S[i] == bg[j] ? d1[i + 1][j + 1] + 1 : 0;
  for (int i = n - 1; i >= 0; i--)
    for (int j = m2 - 1; j >= 0; j--)
      d2[i][j] = S[i] == ed[j] ? d2[i + 1][j + 1] + 1 : 0;
  for (int i = 0; i <= n - 1; i++) {
    if (d1[i][0] != m1) continue;
    int pre = max(m1 - 1, m2 - 1);
    for (int j = 0; j <= i - 1; j++) pre = max(pre, lcp[i][j]);
    for (int j = i + pre; j <= n - 1; j++)
      if (i + m1 <= j + m2 && d2[j - m2 + 1][0] == m2) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
