#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100, M = 52 + 10, LG = 30, base = 2;
const int MOD = 1e9 + 7, mod = 1e9 + 9;
const long long INF = 1e9, inf = 1e18;
long long p, q, m, k;
string w, s, t;
vector<long long> a, b;
vector<long long> ans;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  ;
  cin >> w >> s >> t;
  while (p = w.find(s, p) + 1) a.push_back(p);
  while (q = w.find(t, q) + 1) b.push_back(q);
  for (int i = 0; i < a.size(); i++) {
    m = 0, k = 0;
    for (int j = a[i]; j <= w.size(); j++) {
      while (k < b.size() && b[k] < j) k++;
      if (k < b.size() && b[k] == j && j + t.size() >= a[i] + s.size())
        ans.push_back(m);
      m = m * mod + (w[j - 1] - 'a' + 1);
    }
  }
  sort(ans.begin(), ans.end());
  cout << unique(ans.begin(), ans.end()) - ans.begin();
  return 0;
}
