#include <bits/stdc++.h>
using namespace std;
int lena = 0, lenb = 0, lens = 0, lenans = 0, ans = 0, lenmax = 0;
char a[2000 + 5], b[2000 + 5], s[2000 + 5];
unsigned long long mod = 2333;
unsigned long long ahash = 0, bhash = 0, shash[2000 + 5], base[2000 + 5];
unsigned long long aans[4000000 + 5];
int main() {
  scanf("%s%s%s", s + 1, a + 1, b + 1);
  base[0] = 1;
  lena = strlen(a + 1);
  lenb = strlen(b + 1);
  lens = strlen(s + 1);
  lenmax = max(lena, lenb);
  for (int i = 1; i <= lena; i++)
    ahash = ahash * mod + (unsigned long long)(a[i] - 'a' + 1);
  for (int i = 1; i <= lenb; i++)
    bhash = bhash * mod + (unsigned long long)(b[i] - 'a' + 1);
  for (int i = 1; i <= lens; i++)
    shash[i] = shash[i - 1] * mod + (unsigned long long)(s[i] - 'a' + 1);
  for (int i = 1; i <= lens; i++) base[i] = base[i - 1] * mod;
  for (int i = 1; i <= lens; i++) {
    if (s[i] != a[1]) continue;
    for (int j = i + lenmax - 1; j <= lens; j++) {
      unsigned long long aahash =
          shash[i + lena - 1] - shash[i - 1] * base[lena];
      unsigned long long bbhash = shash[j] - shash[j - lenb] * base[lenb];
      unsigned long long sshash = shash[j] - shash[i - 1] * base[j - i + 1];
      if (ahash == aahash && bhash == bbhash) aans[++lenans] = sshash;
    }
  }
  sort(aans + 1, aans + 1 + lenans);
  for (int i = 1; i <= lenans; i++) {
    if (aans[i] != aans[i - 1] || i == 1) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
