#include <bits/stdc++.h>
using namespace std;
const long long LINF = 1e18 + 7;
const unsigned long long BASE = 29;
const int N = 2e3 + 7;
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const double Pi = acos(-1.);
const double EPS = 1e-8;
long long kpow(long long a, long long b) {
  long long ret = 1;
  for (; b; b >>= 1, a = a * a)
    if (b & 1) ret = ret * a;
  return ret;
}
char t[N], be[N], en[N];
bool ib[N], ie[N];
int tl, bl, el;
unsigned long long b, e, f[N], base[N];
vector<unsigned long long> vec;
unsigned long long get(int l, int r) {
  return f[r] - (l ? f[l - 1] * base[r - l + 1] : 0);
}
unsigned long long calc(char str[]) {
  unsigned long long ret = 0;
  int len = strlen(str);
  for (int i = 0; i < (len); ++i) ret = ret * BASE + str[i] - 'a' + 1;
  return ret;
}
int main() {
  base[0] = 1;
  for (int i = 1; i < (N); ++i) base[i] = base[i - 1] * BASE;
  scanf(" %s %s %s", t, be, en);
  tl = strlen(t), bl = strlen(be), el = strlen(en);
  f[0] = t[0] - 'a' + 1;
  for (int i = 1; i < tl; ++i) f[i] = f[i - 1] * BASE + t[i] - 'a' + 1;
  for (int i = 0; i < (tl); ++i) ib[i] = ie[i] = false;
  b = calc(be), e = calc(en);
  for (int i = 0, I = tl - bl; i <= I; ++i)
    if (get(i, i + bl - 1) == b) ib[i] = true;
  for (int i = tl - 1, I = el - 1; i >= I; --i)
    if (get(i - el + 1, i) == e) ie[i] = true;
  for (int i = 0; i < (tl); ++i)
    for (int j = i + max(bl, el) - 1; j < (tl); ++j)
      if (ib[i] && ie[j]) vec.push_back(get(i, j));
  sort((vec).begin(), (vec).end());
  vec.erase(unique((vec).begin(), (vec).end()), vec.end());
  printf("%d", ((int)((vec).size())));
  return 0;
}
