#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e3 + 10;
unordered_map<unsigned long long, int> mp;
unsigned long long sum[maxn], p[maxn];
char s[maxn], a[maxn], b[maxn];
void init() {
  p[0] = 1;
  for (int i = 1; i < maxn; i++) p[i] = p[i - 1] * 27;
}
int main() {
  init();
  scanf("%s%s%s", s + 1, a + 1, b + 1);
  unsigned long long x = 0, y = 0;
  int len = strlen(s + 1), alen = strlen(a + 1), blen = strlen(b + 1);
  for (int i = 1; i <= alen; i++) x += (a[i] - 'a' + 1) * p[i];
  for (int i = 1; i <= blen; i++) y += (b[i] - 'a' + 1) * p[i];
  x = x * p[len - 1], y = y * p[len - 1];
  long long ans = 0;
  for (int i = 1; i <= len; i++) sum[i] = sum[i - 1] + (s[i] - 'a' + 1) * p[i];
  for (int i = 1; i <= len; i++) {
    for (int j = i; j <= len; j++) {
      int cnt = j - i + 1;
      if (cnt < max(alen, blen)) continue;
      unsigned long long now = (sum[j] - sum[i - 1]) * p[len - i];
      if (mp[now]) continue;
      int p1 = i + alen - 1, p2 = j - blen;
      long long ex = (sum[p1] - sum[i - 1]) * p[len - i],
                ey = (sum[j] - sum[p2]) * p[len - p2 - 1];
      if (ex == x && ey == y) {
        mp[now] = true;
        ans++;
      }
    }
  }
  printf("%lld\n", ans);
  return 0;
}
