#include <bits/stdc++.h>
using namespace std;
const int maxn = 2000 + 20;
char s[maxn], b[maxn], e[maxn];
int ns, nb, ne, k;
long long p[maxn], hs[maxn], hb, he, H[3000000 + 100];
long long has(int i, int j) {
  long long help = hs[j];
  if (i != 0) help -= hs[i - 1];
  help *= p[ns - 1 - i];
  return help;
}
int main() {
  scanf("%s%s%s", s, b, e);
  ns = strlen(s);
  nb = strlen(b);
  ne = strlen(e);
  p[0] = 1;
  for (int i = 1; i < maxn; ++i) {
    p[i] = p[i - 1] * 37;
  }
  for (int i = 0; i < ns; ++i) {
    hs[i] = (s[i] - 'a' + 1) * p[i];
    if (i != 0) hs[i] += hs[i - 1];
  }
  for (int i = 0; i < nb; ++i) {
    hb += (b[i] - 'a' + 1) * p[i];
  }
  for (int i = 0; i < ne; ++i) {
    he += (e[i] - 'a' + 1) * p[i];
  }
  hb *= p[ns - 1];
  he *= p[ns - 1];
  for (int l = 1; l <= ns; ++l) {
    if (l < nb || l < ne) {
      continue;
    }
    for (int i = 0; i + l - 1 < ns; ++i) {
      if (has(i, i + nb - 1) == hb && has(i + l - ne, i + l - 1) == he) {
        H[k++] = has(i, i + l - 1);
      }
    }
  }
  sort(H, H + k);
  int answer = 0;
  answer = k > 0;
  for (int i = 1; i < k; ++i) {
    if (H[i] != H[i - 1]) {
      answer++;
    }
  }
  cout << answer;
}
