#include <bits/stdc++.h>
using namespace std;
int T[2010], o[2010];
vector<int> B;
int n, rss;
bool G = 1;
void cT(string &Needle) {
  int i = 0, j = -1;
  T[i] = j;
  while (i < Needle.size()) {
    while (j >= 0 && Needle[i] != Needle[j]) j = T[j];
    T[++i] = ++j;
  }
}
void fO(string &Needle, string &Hay) {
  int i = 0, j = 0;
  cT(Needle);
  while (i < Hay.size()) {
    while (j >= 0 && Hay[i] != Needle[j]) j = T[j];
    i++;
    j++;
    if (j == Needle.size()) {
      if (G)
        B.push_back(i - rss - 1);
      else
        o[n - i] = 1;
      j = T[j];
    }
  }
}
const long long M1 = 100000000739;
int main() {
  string s, b, e;
  cin >> s >> b >> e;
  int MX = max(e.size(), b.size());
  n = s.size();
  if (MX > n) {
    puts("0");
    return 0;
  }
  rss = int(min(e.size(), b.size())) - 1;
  fO(b, s);
  G = 0;
  reverse(s.begin(), s.end());
  reverse(e.begin(), e.end());
  fO(e, s);
  reverse(s.begin(), s.end());
  vector<long long> r;
  for (int &x : B) {
    long long h2 = 0;
    for (int j = x; j < n; j++) {
      h2 = (h2 * M1 + (s[j] - 'a' + 3));
      if (o[j]) r.push_back(h2);
    }
  }
  sort(r.begin(), r.end());
  int anw = 0;
  for (int i = 1; i < r.size(); i++)
    if (r[i] != r[i - 1]) anw++;
  if (r.size() > 0) anw++;
  cout << anw << endl;
}
