#include <bits/stdc++.h>
using namespace std;
const long long x = 277;
int n, m, na, nb;
int i, j, k, l;
int res;
char s[2222], a[2222], b[2222];
long long h[2222], p[2222];
bool ia[2222], ib[2222];
long long z[4000006];
int d;
int main() {
  cin >> s >> a >> b;
  n = strlen(s);
  na = strlen(a);
  nb = strlen(b);
  h[0] = s[0];
  for (typeof(i) &i_ = i = (1), e_ = (n); i_ < e_; ++i_)
    h[i] = h[i - 1] * x + s[i];
  p[0] = 1;
  for (typeof(i) &i_ = i = (1), e_ = (n + 1); i_ < e_; ++i_)
    p[i] = p[i - 1] * x;
  res = 0;
  for (typeof(i) &i_ = i = (0), e_ = (n); i_ < e_; ++i_) {
    ia[i] = true;
    for (j = 0; j < na; ++j)
      if (i + j >= n || s[i + j] != a[j]) {
        ia[i] = false;
        break;
      }
    if (i + nb > n) continue;
    ib[i + nb - 1] = true;
    for (j = 0; j < nb; ++j)
      if (i + j >= n || s[i + j] != b[j]) {
        ib[i + nb - 1] = false;
        break;
      }
  }
  d = 0;
  for (typeof(i) &i_ = i = (0), e_ = (n); i_ < e_; ++i_)
    if (ia[i])
      for (typeof(j) &i_ = j = (i), e_ = (n); i_ < e_; ++i_)
        if (ib[j] && i + na - 1 <= j && j - nb + 1 >= i) {
          z[d++] = (h[j] - (i ? h[i - 1] : 0) * p[j - i + 1]);
        }
  sort(z, z + d);
  res = 0;
  for (typeof(i) &i_ = i = (1), e_ = (d + 1); i_ < e_; ++i_)
    if (!i || i == d || z[i] != z[i - 1]) ++res;
  cout << res;
  return 0;
}
