#include <bits/stdc++.h>
using namespace std;
string t, b, e;
int p;
vector<int> v1, v2;
int main() {
  ios::sync_with_stdio(false);
  cin >> t >> b >> e;
  while (p = t.find(b, p) + 1) {
    v1.push_back(p - 1);
  }
  p = 0;
  while (p = t.find(e, p) + 1) {
    v2.push_back(p - 1);
  }
  unordered_set<unsigned long long> ans;
  for (int i : v1) {
    int k = i;
    unsigned long long code = 0;
    for (int j : v2) {
      if (i <= j && i + (int)b.length() <= j + (int)e.length()) {
        while (k < j + (int)e.length()) {
          code = code * 31 + t[k++];
        }
        ans.insert(code);
      }
    }
  }
  cout << ans.size() << endl;
  return 0;
}
