#include <bits/stdc++.h>
using namespace std;
const int N = 2001, B = 27, M1 = 1e9 + 7, M2 = 1e9 + 9;
int n, m, k, F[2][N];
char a[N], b[N], c[N];
vector<pair<int, int> > H;
void build(int N, char *s, int *F) {
  for (int i = 1, j = 0; i < N; ++i) {
    while (j != 0 && s[j] != s[i]) j = F[j - 1];
    F[i] = j;
    if (s[j] == s[i]) F[i] = ++j;
  }
}
int main(int argc, char **argv) {
  scanf("%s%s%s", a, b, c);
  n = strlen(a);
  m = strlen(b);
  k = strlen(c);
  build(m, b, F[0]);
  build(k, c, F[1]);
  for (int i = 0, x = 0; i < n; ++i) {
    while (x != 0 && b[x] != a[i]) x = F[0][x - 1];
    if (b[x] == a[i]) ++x;
    if (x != m) continue;
    int str = i - m + 1, pos = 0;
    long long h1 = 0, h2 = 0;
    for (int j = str; j < n; ++j) {
      while (pos != 0 && c[pos] != a[j]) {
        pos = F[1][pos - 1];
      }
      if (c[pos] == a[j]) ++pos;
      h1 = (h1 * B + (a[j] - 'a' + 1)) % M1;
      h2 = (h2 * B + (a[j] - 'a' + 1)) % M2;
      if (pos == k) {
        if (j >= str + m - 1) H.push_back(make_pair(h1, h2));
        pos = F[1][pos - 1];
      }
    }
  }
  sort(H.begin(), H.end());
  H.resize(unique(H.begin(), H.end()) - H.begin());
  printf("%d\n", (int)H.size());
  return 0;
}
