#include <bits/stdc++.h>
using namespace std;
char str[2007], be[2007], en[2007];
bool bee[3000], enn[3000];
struct data {
  bool isword;
  struct data *next[26];
  data() {
    isword = false;
    memset(next, NULL, sizeof(next));
  }
};
struct data *root;
int find() {
  int i, len, j, len1, len2, sum, length;
  sum = 0;
  len = strlen(str);
  len1 = strlen(be);
  len2 = strlen(en);
  for (i = 0; i <= len - len1; i++) {
    bee[i] = true;
    for (j = 0; j < len1; j++)
      if (str[i + j] != be[j]) {
        bee[i] = false;
        break;
      }
  }
  for (i = len2 - 1; i < len; i++) {
    enn[i] = true;
    for (j = i; j > i - len2; j--)
      if (str[j] != en[len2 - (i - j + 1)]) {
        enn[i] = false;
        break;
      }
  }
  if (len2 >= len1)
    length = len2;
  else
    length = len1;
  for (i = 0; i < len; i++) {
    if (bee[i]) {
      int ans;
      struct data *p = root;
      for (j = i; j < len; j++) {
        ans = str[j] - 'a';
        if (p->next[ans] == NULL) p->next[ans] = new (struct data);
        if (j - i + 1 >= length && enn[j] && p->isword == false) {
          p->isword = true;
          sum++;
        }
        p = p->next[ans];
      }
    }
  }
  return sum;
}
int main() {
  while (scanf("%s%s%s", str, be, en) != EOF) {
    root = new (struct data);
    printf("%d\n", find());
  }
}
