#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
long long powmod(long long a, long long l, long long md) {
  a %= md;
  long long res = 1;
  while (l) {
    if (l & 1) res = res * a % md;
    l /= 2;
    a = a * a % md;
  }
  return res;
}
long long binpow(long long a, long long l) {
  long long res = 1;
  while (l) {
    if (l & 1) res = res * a;
    l /= 2;
    a = a * a;
  }
  return res;
}
long long invmod(long long a, long long md) { return powmod(a, md - 2, md); }
long long __set(long long b, long long i) { return b | (1LL << i); }
long long __unset(long long b, long long i) { return b & (~(1UL << i)); }
long long __check(long long b, long long i) { return b & (1LL << i); }
long long mulmod(long long a, long long b, long long md) {
  return ((a % md) * (b % md)) % md;
}
long long addmod(long long a, long long b, long long md) {
  return (a + b) % md;
}
long long submod(long long a, long long b, long long md) {
  return (((a - b) % md) + md) % md;
}
long long divmod(long long a, long long b, long long md) {
  return mulmod(a, powmod(b, md - 2, md), md);
}
const long long inf = 0xFFFFFFFFFFFFFFFL;
priority_queue<long long, vector<long long>, greater<long long>> pq;
clock_t time_p = clock();
void time() {
  time_p = clock() - time_p;
  cerr << "Time Taken : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}
long long m1 = 1e9 + 123;
long long mxPow;
long long gen_base(const long long before, const long long after) {
  auto seed =
      std::chrono::high_resolution_clock::now().time_since_epoch().count();
  std::mt19937 mt_rand(seed);
  long long base =
      std::uniform_int_distribution<long long>(before + 1, after)(mt_rand);
  return base % 2 == 0 ? base - 1 : base;
}
struct PolyHash {
  static const long long mod = (long long)1e9 + 123;
  static std::vector<long long> pow1;
  static std::vector<unsigned long long> pow2;
  static long long base;
  static inline long long diff(long long a, long long b) {
    return (a -= b) < 0 ? a + mod : a;
  }
  std::vector<long long> pref1;
  std::vector<unsigned long long> pref2;
  PolyHash(const std::string& s, long long mxPow)
      : pref1(s.size() + 1u, 0), pref2(s.size() + 1u, 0) {
    assert(base < mod);
    const long long n = s.size();
    while ((long long)pow1.size() <= mxPow) {
      pow1.push_back(1LL * pow1.back() * base % mod);
      pow2.push_back(pow2.back() * base);
    }
    for (long long i = 0; i < n; ++i) {
      assert(base > s[i]);
      pref1[i + 1] = (pref1[i] + 1LL * s[i] * pow1[i]) % mod;
      pref2[i + 1] = pref2[i] + s[i] * pow2[i];
    }
  }
  inline std::pair<long long, unsigned long long> operator()(
      const long long pos, const long long len,
      const long long mxPow = 0) const {
    long long hash1 = pref1[pos + len] - pref1[pos];
    unsigned long long hash2 = pref2[pos + len] - pref2[pos];
    if (hash1 < 0) hash1 += mod;
    if (mxPow != 0) {
      hash1 = 1LL * hash1 * pow1[mxPow - (pos + len - 1)] % mod;
      hash2 *= pow2[mxPow - (pos + len - 1)];
    }
    return std::make_pair(hash1, hash2);
  }
};
long long PolyHash::base((long long)1e9 + 7);
std::vector<long long> PolyHash::pow1{1};
std::vector<unsigned long long> PolyHash::pow2{1};
pair<long long, unsigned long long> hashThis(string gg) {
  long long h1 = 0, k = gg.length();
  unsigned long long h2 = 0;
  for (long long i = 0; i < gg.length(); i++) {
    h1 = (h1 + gg[i] * PolyHash::pow1[i]);
    if (h1 >= m1) h1 %= m1;
  }
  for (long long i = 0; i < gg.length(); i++) {
    h2 = (h2 + gg[i] * PolyHash::pow2[i]);
  }
  return {(PolyHash::pow1[mxPow - k + 1] * h1) % m1,
          PolyHash::pow2[mxPow - k + 1] * h2};
}
signed main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  string s;
  cin >> s;
  long long n = s.length();
  PolyHash::base = gen_base(256, PolyHash::mod);
  mxPow = n;
  PolyHash hash(s, mxPow);
  string s1;
  string s2;
  cin >> s1 >> s2;
  long long n1 = s1.length(), n2 = s2.length();
  if (n1 > n || n2 > n) {
    cout << 0 << endl;
    return 0;
  }
  pair<long long, unsigned long long> hlo = hashThis(s1);
  pair<long long, unsigned long long> hhi = hashThis(s2);
  vector<pair<long long, unsigned long long>> ans;
  for (long long i = 0; i <= n - n1; i++) {
    if (hash(i, n1, mxPow) == hlo) {
      for (long long j = i + n1 - 1; j < n; j++) {
        if (j - n2 + 1 < i) continue;
        if (hash(j - n2 + 1, n2, mxPow) == hhi)
          ans.push_back((hash(i, j - i + 1, mxPow)));
      }
    }
  }
  sort((ans).begin(), (ans).end());
  long long sum = 0;
  for (long long i = 0; i < (long long)(ans.size()); i++) {
    if (i == 0)
      sum++;
    else if (ans[i - 1].first == ans[i].first &&
             ans[i - 1].second == ans[i].second)
      continue;
    else
      sum++;
  }
  cout << sum << endl;
  time();
  return 0;
}
