#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2007;
struct node {
  int c;
  node *link[30];
  node() {
    c = 0;
    for (int i = 0; i < int(31); ++i) link[i] = NULL;
  }
};
string s;
char sBegin[MAX_N], sEnd[MAX_N], t[MAX_N];
int kmp[MAX_N], f[MAX_N], g[MAX_N], Lmax[MAX_N];
bool ok[MAX_N][MAX_N];
node *root = new node();
void kmp_table(char str[]) {
  s = str;
  int j = 0;
  kmp[0] = 0;
  for (int i = int(1); i <= int(int(s.size()) - 1); ++i) {
    while (j && s[j] != s[i]) j = kmp[j - 1];
    if (s[j] == s[i]) ++j;
    kmp[i] = j;
  }
}
void kmp_search(int a[]) {
  int j = 0;
  for (int i = 0; i < int(strlen(t)); ++i) {
    while (j && s[j] != t[i]) j = kmp[j - 1];
    if (s[j] == t[i]) ++j;
    a[i] = j;
    if (j == int(s.size())) j = kmp[j - 1];
  }
}
int main() {
  scanf("%s%s%s", t, sBegin, sEnd);
  int n = strlen(t), m1 = strlen(sBegin), m2 = strlen(sEnd);
  kmp_table(sBegin);
  kmp_search(f);
  kmp_table(sEnd);
  kmp_search(g);
  memset(ok, (false), sizeof(ok));
  memset(Lmax, (0), sizeof(Lmax));
  for (int i = 0; i < int(n); ++i)
    for (int j = int(i); j <= int(n - 1); ++j) {
      int k = i - f[i] + 1;
      if (f[i] == m1 && g[j] == m2 && k <= j - g[j] + 1) {
        Lmax[k] = max(Lmax[k], j - k + 1);
        ok[k][j] = true;
      }
    }
  int res = 0;
  for (int i = 0; i < int(n); ++i) {
    node *p = root;
    for (int len = 0; len < int(Lmax[i]); ++len) {
      int j = i + len, x = t[j] - 'a';
      if (p->link[x] == NULL) p->link[x] = new node();
      p = p->link[x];
      if (ok[i][j] && !p->c) ++res;
      ++p->c;
    }
  }
  printf("%d", res);
  return 0;
}
