#include <bits/stdc++.h>
using namespace std;
const long long inf = 3e18 + 5;
const int mod[2] = {(int)1e9 + 9, (int)1e9 + 7};
const int p[2] = {31, 29};
int add(int a, int b, int i) { return (a += b) < mod[i] ? a : a - mod[i]; }
int sub(int a, int b, int i) { return (a -= b) >= 0 ? a : a + mod[i]; }
int mul(int a, int b, int i) { return 1LL * a * b % mod[i]; }
int pwr(int a, int p, int i) {
  if (p == 0) return 1;
  if (p & 1) return mul(a, pwr(a, p - 1, i), i);
  return pwr(mul(a, a, i), p / 2, i);
}
const int maxn = 10000;
int invp[maxn][2], ppow[maxn][2], pref[maxn + 1][2];
int inv(int a, int i) { return pwr(a, mod[i] - 2, i); }
void pre_hash(const string& s, int j) {
  for (int i = 0; i < s.size(); ++i)
    pref[i + 1][j] = add(pref[i][j], mul(s[i] - 'a' + 1, ppow[i][j], j), j);
}
int substr_hash(int i, int j, int k) {
  return mul(invp[i][k], sub(pref[j + 1][k], pref[i][k], k), k);
}
int hash_f(const string& s, int j) {
  long long p = 1, h = 0;
  for (int i = 0; i < s.size(); ++i)
    h = add(h, mul(s[i] - 'a' + 1, ppow[i][j], j), j);
  return h;
}
vector<int> rabin_karp(string const& s, string const& t) {
  long long h_s = hash_f(s, 0);
  long long h_s1 = hash_f(s, 1);
  vector<int> occurences;
  for (int i = 0; i + s.size() - 1 < t.size(); i++)
    if (substr_hash(i, i + s.size() - 1, 0) == h_s &&
        substr_hash(i, i + s.size() - 1, 1) == h_s1)
      occurences.push_back(i);
  return occurences;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string s, sb, se;
  cin >> s;
  cin >> sb;
  cin >> se;
  invp[0][0] = ppow[0][0] = 1;
  invp[0][1] = ppow[0][1] = 1;
  for (int j = 0; j < 2; j++) {
    for (int i = 1; i < maxn; ++i) {
      ppow[i][j] = mul(ppow[i - 1][j], p[j], j);
      invp[i][j] = inv(ppow[i][j], j);
    }
    pre_hash(s, j);
  }
  vector<int> start, end;
  start = rabin_karp(sb, s);
  end = rabin_karp(se, s);
  int sb_s, se_s;
  sb_s = sb.size();
  se_s = se.size();
  vector<pair<int, int> > sol;
  for (int x : start)
    for (int y : end) {
      if (y + se_s >= x + sb_s && x <= y)
        sol.emplace_back(substr_hash(x, y + se_s - 1, 0),
                         substr_hash(x, y + se_s - 1, 1));
    }
  sort(sol.begin(), sol.end());
  auto last = unique(sol.begin(), sol.end());
  sol.erase(last, sol.end());
  cout << sol.size();
}
