#include <bits/stdc++.h>
using namespace std;
const int maxn = 2002;
int base1 = 103, base2 = 127, base3 = 151;
int po1[maxn], po2[maxn], po3[maxn];
struct lsfinbklsf {
  int h1, h2, h3, len;
  lsfinbklsf() { h1 = h2 = h3 = len = 0; }
  inline bool operator==(const lsfinbklsf &temp) const {
    return (h1 == temp.h1 and h2 == temp.h2);
  }
  inline bool operator<(const lsfinbklsf &temp) const {
    if (h1 == temp.h1) {
      return h2 < temp.h2;
    }
    return h1 < temp.h1;
  }
  inline void operator+=(char ch) {
    len++;
    h1 = (h1 + po1[len] * ch) % 4999507;
    h2 = (h2 + po2[len] * ch) % 4999727;
  }
};
lsfinbklsf H[maxn][maxn];
char s[maxn], sb[maxn], se[maxn];
int n, b, e;
vector<lsfinbklsf> st;
lsfinbklsf startH, endH;
void doFor(int k) {
  for (int i = 1; i + k - 1 <= n; i++) {
    int j = i + k - 1;
    if (H[j - e + 1][j] == endH and H[i][i + b - 1] == startH)
      st.push_back(H[i][j]);
  }
}
int32_t main() {
  po1[1] = base1;
  for (int i = 2; i <= 2000; i++) po1[i] = po1[i - 1] * base1;
  po2[1] = base2;
  for (int i = 2; i <= 2000; i++) po2[i] = po2[i - 1] * base2;
  gets(s + 1);
  gets(sb + 1);
  gets(se + 1);
  n = strlen(s + 1), b = strlen(sb + 1), e = strlen(se + 1);
  for (int i = 1; i <= b; i++) startH += sb[i];
  for (int i = 1; i <= e; i++) endH += se[i];
  for (int i = 1; i <= n; i++) {
    lsfinbklsf now;
    for (int j = i; j <= n; j++) {
      now += s[j];
      H[i][j] = now;
    }
  }
  if (n < max(b, e)) {
    puts("0");
    return 0;
  }
  for (int i = max(b, e); i <= n; i++) {
    doFor(i);
  }
  sort(st.begin(), st.end());
  st.erase(unique(st.begin(), st.end()), st.end());
  printf("%d\n", (int)st.size());
  return 0;
}
