#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 9;
const long long mod1 = 70502963;
const long long base = 311;
vector<pair<long long, long long> > s;
string t, be, en, md;
long long h[20005], pow1[20005], h1[20005], pow11[20005];
long long hbe, hen, kq, hmd, hbe1, hen1;
void nhap() {
  ios_base::sync_with_stdio(0);
  cin >> t;
  cin >> be;
  cin >> en;
}
void prep() {
  for (int i = 0; i < t.length(); ++i)
    h[i] = (h[i - 1] * base + t[i] - 'a' + 1) % mod;
  pow1[0] = 1;
  for (int i = 1; i <= t.length(); ++i) pow1[i] = (pow1[i - 1] * base) % mod;
  for (int i = 0; i < be.length(); ++i)
    hbe = (hbe * base + be[i] - 'a' + 1) % mod;
  for (int i = 0; i < en.length(); ++i)
    hen = (hen * base + en[i] - 'a' + 1) % mod;
}
void prep1() {
  for (int i = 0; i < t.length(); ++i)
    h1[i] = (h1[i - 1] * base + t[i] - 'a' + 1) % mod1;
  pow11[0] = 1;
  for (int i = 1; i <= t.length(); ++i) pow11[i] = (pow11[i - 1] * base) % mod1;
  for (int i = 0; i < be.length(); ++i)
    hbe1 = (hbe1 * base + be[i] - 'a' + 1) % mod1;
  for (int i = 0; i < en.length(); ++i)
    hen1 = (hen1 * base + en[i] - 'a' + 1) % mod1;
}
long long get(int l, int r) {
  return (h[r] - h[l - 1] * pow1[r - l + 1] + mod * mod) % mod;
}
long long get1(int l, int r) {
  return (h1[r] - h1[l - 1] * pow11[r - l + 1] + mod1 * mod1) % mod1;
}
void xl() {
  for (int i = 0; i < t.length(); ++i) {
    for (int j = i; j < t.length(); ++j) {
      if (j - i + 1 >= max(be.length(), en.length()) &&
          j - en.length() + 1 >= 0 && i + be.length() - 1 < t.length()) {
        long long t1, t2;
        t1 = get(i, i + be.length() - 1);
        t2 = get(j - en.length() + 1, j);
        long long t11, t21;
        t11 = get1(i, i + be.length() - 1);
        t21 = get1(j - en.length() + 1, j);
        if (t1 == hbe && t2 == hen && t11 == hbe1 && t21 == hen1) {
          pair<long long, long long> t;
          t.first = get(i, j);
          t.second = get1(i, j);
          s.push_back(t);
        }
      }
    }
  }
  sort(s.begin(), s.end());
  cout << unique(s.begin(), s.end()) - s.begin();
}
int main() {
  nhap();
  prep();
  prep1();
  xl();
  return 0;
}
