#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int mod = 1e9 + 7;
const double eps = 1e-6;
const int N = 2e3 + 7;
int ne[N];
string s, t;
unsigned long long p[N], h[N];
vector<int> L, R;
void init() {
  p[0] = h[0] = 1;
  for (int i = (1); (s[i]); i++) {
    p[i] = p[i - 1] * 131;
    h[i] = h[i - 1] * 131 + s[i];
  }
}
unsigned long long find(int l, int r) { return h[r] - h[l - 1] * p[r - l + 1]; }
void kmp(vector<int>& v) {
  int l = t.size() - 1;
  ne[0] = ne[1] = 0;
  for (int i = 2, j = 0; t[i]; i++) {
    while (j && t[i] != t[j + 1]) j = ne[j];
    if (t[i] == t[j + 1]) j++;
    ne[i] = j;
  }
  for (int i = 1, j = 0; s[i]; i++) {
    while (j && s[i] != t[j + 1]) j = ne[j];
    if (s[i] == t[j + 1]) j++;
    if (j == l) v.push_back(i);
  }
}
unordered_map<unsigned long long, bool> mp;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ;
  cin >> s;
  s = ' ' + s;
  init();
  cin >> t;
  t = ' ' + t;
  int l1 = t.size() - 1;
  kmp(L);
  cin >> t;
  t = ' ' + t;
  kmp(R);
  int l2 = t.size() - 1;
  int res = 0, k = R.size(), p = L.size();
  for (int i = (0); i <= (p - 1); i++) {
    int s = lower_bound(R.begin(), R.end(), L[i]) - R.begin();
    for (int j = (s); j <= (k - 1); j++) {
      int l = R[j] - L[i] + l1;
      if (l < max(l1, l2)) continue;
      unsigned long long temp = find(L[i] - l1 + 1, R[j]);
      if (!mp.count(temp)) {
        mp[temp] = true;
        res++;
      }
    }
  }
  cout << res << endl;
  return 0;
}
