#include <bits/stdc++.h>
using namespace std;
const int maxn = 9000100;
const int mm = 10100;
vector<pair<int, char> > trie[maxn];
int len = 1;
bool match[mm];
bool same[mm];
int ind;
int n;
int ans;
string s;
bool mark[maxn];
int t;
int k;
int m;
void inline add() {
  int cur = 0;
  while (ind < n) {
    bool found = 0;
    for (auto x : trie[cur])
      if (x.second == s[ind]) {
        cur = x.first;
        found = 1;
        break;
      }
    if (!found) {
      trie[cur].push_back(make_pair(len, s[ind]));
      len++;
      cur = len - 1;
    }
    if (same[ind] and !mark[cur] and ind - k + 1 >= t and ind >= t + m - 1) {
      ans++;
      mark[cur] = 1;
    }
    ind++;
  }
}
int32_t main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  string st, en;
  cin >> s >> st >> en;
  n = s.length();
  m = st.length();
  k = en.length();
  for (int i = 0; i < n; i++) {
    match[i] = (i <= n - m);
    if (i <= n - k) same[i + k - 1] = (i <= n - k);
    if (i <= n - m)
      for (int j = 0; j < m; j++) match[i] &= (s[i + j] == st[j]);
    if (i <= n - k)
      for (int j = 0; j < k; j++) same[i + k - 1] &= (s[i + j] == en[j]);
  }
  for (int i = 0; i < n; i++) {
    if (!match[i]) continue;
    ind = i;
    t = ind;
    add();
  }
  cout << ans << "\n";
  return 0;
}
