#include <bits/stdc++.h>
using namespace std;
vector<int> compute_kmp_prefix3(const string& pat) {
  int m = int(pat.size());
  vector<int> next(m + 1);
  int i = 0;
  int j = next[0] = -1;
  while (i < m) {
    while (j > -1 && pat[i] != pat[j]) j = next[j];
    i++;
    j++;
    if (pat[i] == pat[j])
      next[i] = next[j];
    else
      next[i] = j;
  }
  return next;
}
vector<int> kmp_matcher3(const string& text, const string& pat) {
  vector<int> next = compute_kmp_prefix3(pat);
  int n = int(text.size());
  int m = int(pat.size());
  vector<int> res;
  int i = 0;
  int j = 0;
  while (j < n) {
    while (i > -1 && pat[i] != text[j]) i = next[i];
    i++;
    j++;
    if (i >= m) {
      res.push_back(j - i);
      i = next[i];
    }
  }
  return res;
}
char T[2004];
char Sbeg[2004], Send[2004];
struct String {
  int beg, end;
  String(int _beg = 0, int _end = 0) : beg(_beg), end(_end) {}
  bool operator==(const String& s) const {
    if (end - beg != s.end - s.beg) return false;
    for (int i = beg, j = s.beg; i <= end; ++i, ++j)
      if (T[i] != T[j]) return false;
    return true;
  }
};
bool bend[2004];
vector<String> HT[10000019];
int main(int argc, char* argv[]) {
  scanf("%s", T);
  string strT(T);
  scanf("%s", Sbeg);
  string strSbeg(Sbeg);
  vector<int> matches_beg = kmp_matcher3(strT, strSbeg);
  scanf("%s", Send);
  string strSend(Send);
  vector<int> matches_end = kmp_matcher3(strT, strSend);
  for (int j = 0, _n = (int((matches_end).size())); j < _n; ++j)
    bend[matches_end[j]] = true;
  int res = 0;
  for (int i = 0, _n = (int((matches_beg).size())); i < _n; ++i) {
    int b = matches_beg[i];
    int h = 0;
    for (int e = (b), _b = (int((strT).size()) - int((strSend).size()));
         e <= _b; ++e) {
      h = ((h * 33) ^ T[e]) % 10000019;
      if (bend[e] &&
          e + int((strSend).size()) - 1 >= b + int((strSbeg).size()) - 1) {
        String sss(b, e + int((strSend).size()) - 1);
        vector<String>& v = HT[h];
        bool found = false;
        for (int k = 0, _n = (int((v).size())); k < _n; ++k) {
          if (v[k] == sss) {
            found = true;
            break;
          }
        }
        if (!found) {
          ++res;
          v.push_back(sss);
        }
      }
    }
  }
  printf("%d\n", res);
  return 0;
}
