#include <bits/stdc++.h>
using namespace std;
vector<int> pos(const string& s, const string& p) {
  vector<int> ret;
  for (string::size_type i = s.find(p); i != string::npos;
       i = s.find(p, i + 1)) {
    ret.push_back(i);
  }
  return ret;
}
int main() {
  string str, pre, suffix;
  cin >> str >> pre >> suffix;
  vector<int> st, ed;
  vector<unsigned long long> ha;
  st = pos(str, pre);
  ed = pos(str, suffix);
  for (int i : st) {
    unsigned long long ans = 0;
    int k = i;
    for (int j : ed) {
      if (i <= j && i + (int)pre.length() <= j + (int)suffix.length()) {
        while (k < j + (int)suffix.length()) {
          ans = ans * 29 + str[k++];
        }
        ha.push_back(ans);
      }
    }
  }
  sort(ha.begin(), ha.end());
  printf("%d\n", (int)(unique(ha.begin(), ha.end()) - ha.begin()));
  return 0;
}
