#include <bits/stdc++.h>
using namespace std;
bool st[2000], ed[2000];
char a[2001], b[2001], c[2001];
int md = 1e9 + 13;
double ch = 27.321;
set<double> s[2000];
double dd(double x) { return x - floor(x / md) * md; }
void nxt(double &x) {
  double z = dd(x * ch);
  z = floor(z * 1000) / 1000;
  x = z;
}
int main() {
  scanf("%s%s%s", a, b, c);
  int n = strlen(a), nb = strlen(b), nc = strlen(c);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < nb; ++j) {
      if (i + j == n || b[j] != a[i + j]) break;
      if (j + 1 == nb) st[i] = true;
    }
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < nc; ++j) {
      if (i + j == n || c[j] != a[i + j]) break;
      if (j + 1 == nc) ed[i + j] = true;
    }
  string g = a;
  int l = max(nb, nc);
  for (int i = 0; i < n; ++i) {
    double z = 0, p = 1;
    for (int j = i; j < i + l - 1; ++j)
      z = dd(z + (a[j] - 'a' + 1) * p), nxt(p);
    for (int j = i + l - 1; j < n; ++j) {
      z = dd(z + (a[j] - 'a' + 1) * p), nxt(p);
      if (st[i] && ed[j]) s[j - i].insert(z);
    }
  }
  int an = 0;
  for (int i = 0; i < n; ++i) an += s[i].size();
  printf("%d", an);
}
