#include <bits/stdc++.h>
using namespace std;
unordered_set<long long> hs;
int main() {
  string t, b, e;
  cin >> t >> b >> e;
  vector<size_t> pe;
  for (size_t i = 0; i + e.size() <= t.size();) {
    size_t tmp = t.find(e, i);
    if (tmp == string::npos) break;
    pe.push_back(tmp);
    i = tmp + 1;
  }
  size_t idx = 0;
  for (size_t i = t.find(b); i != string::npos;) {
    while (idx < pe.size() && pe[idx] < i) idx++;
    if (idx == pe.size()) break;
    long long hsvalue = 0;
    size_t lst = i;
    for (size_t j = idx; j < pe.size(); j++) {
      for (size_t k = lst; k < pe[j] + e.size(); k++) (hsvalue *= 171) += t[k];
      if (pe[j] + e.size() >= i + b.size()) hs.insert(hsvalue);
      lst = pe[j] + e.size();
    }
    i = t.find(b, i + 1);
  }
  cout << hs.size();
  return 0;
}
