#include <bits/stdc++.h>
using namespace std;
int f[2010][2010], g[2010];
int L[2010], R[2010];
int n1, n2, n;
char str[2010], s1[2010], s2[2010];
int main() {
  int i, j, k;
  int ans;
  while (scanf("%s", str) != EOF) {
    scanf("%s", s1);
    scanf("%s", s2);
    n = strlen(str);
    n1 = strlen(s1);
    n2 = strlen(s2);
    for (i = 0; i < n; i++) {
      R[i] = 0;
      for (j = 0; j < n1; j++) {
        if (str[i + j] != s1[j]) break;
        R[i]++;
      }
    }
    g[n] = 0;
    for (i = n - 1; i >= 0; i--) {
      L[i] = 0;
      for (j = 0; j < n2; j++) {
        if (str[i - j] != s2[n2 - j - 1]) break;
        L[i]++;
      }
      g[i] = g[i + 1];
      if (L[i] >= n2) g[i]++;
    }
    for (i = n - 1; i >= 0; i--) {
      for (j = i; j < n; j++) {
        if (str[i] != str[j]) {
          f[i][j] = 0;
          continue;
        }
        if (i == n - 1 || j == n - 1) {
          f[i][j] = 1;
        } else if (str[i + 1] == str[j + 1])
          f[i][j] = f[i + 1][j + 1] + 1;
        else
          f[i][j] = 1;
      }
    }
    ans = 0;
    for (i = 0; i < n; i++) {
      if (R[i] < n1) {
        continue;
      }
      k = max(n1 - 1, n2 - 1);
      for (j = 0; j < i; j++) {
        k = max(k, f[j][i]);
      }
      k = min(n, i + k);
      ans += g[k];
    }
    printf("%d\n", ans);
  }
  return 0;
}
