#include <bits/stdc++.h>
using namespace std;
string s, s1, s2;
int n, n1, n2, h[11111];
vector<int> pos1, pos2;
long long h1[11111], p1[11111];
vector<long long> t;
void init() {
  cin >> s >> s1 >> s2;
  n = ((int)(s.length()));
  n1 = ((int)(s1.length()));
  n2 = ((int)(s2.length()));
  p1[0] = 1;
  for (int i = 1; i <= (n - 1); i++) p1[i] = (p1[i - 1] * 31ll);
}
void kmp() {
  string ss = s1 + '$' + s;
  int k = 0, n = ((int)(ss.length()));
  h[0] = 0;
  for (int i = 1; i <= (n - 1); i++) {
    while (k > 0 && ss[k] != ss[i]) k = h[k - 1];
    if (ss[k] == ss[i]) ++k;
    h[i] = k;
    if (k == ((int)(s1.length())))
      pos1.push_back(i - ((int)(s1.length())) - ((int)(s1.length())));
  }
  ss = s2 + '$' + s;
  n = ((int)(ss.length()));
  k = 0;
  for (int i = 1; i <= (n - 1); i++) {
    while (k > 0 && ss[k] != ss[i]) k = h[k - 1];
    if (ss[k] == ss[i]) ++k;
    h[i] = k;
    if (k == ((int)(s2.length()))) pos2.push_back(i - ((int)(s2.length())) - 1);
  }
}
void hash_calc() {
  h1[0] = s[0] - 'a' + 1;
  for (int i = 1; i <= (n - 1); i++)
    h1[i] = (h1[i - 1] + p1[i] * (s[i] - 'a' + 1));
}
int main() {
  init();
  if (n1 > n || n2 > n) {
    cout << 0 << endl;
    return 0;
  }
  kmp();
  hash_calc();
  for (int i = 0; i < (((int)(pos1.size()))); i++)
    for (int j = 0; j < (((int)(pos2.size()))); j++) {
      if (pos2[j] < pos1[i] || pos2[j] - pos1[i] + 1 < max(n1, n2)) continue;
      int x = pos1[i], y = pos2[j], len = pos2[j] - pos1[i] + 1;
      long long H1 = (h1[y] - (x ? h1[x - 1] : 0)) * p1[n - x - len];
      t.push_back(H1);
    }
  sort(t.begin(), t.end());
  cout << unique(t.begin(), t.end()) - t.begin() << endl;
}
