#include <bits/stdc++.h>
using namespace std;
const int N = 2002;
string t, b, e;
int hash1[N], hash2[N], hash1B, hash1E, hash2B, hash2E, power1[N], power2[N];
void buildHash() {
  for (int i = t.length() - 1; i >= 0; i--) {
    hash1[i] =
        (1LL * hash1[i + 1] * 43 % 1000000007 + t[i] - 'a' + 1) % 1000000007;
    hash2[i] =
        (1LL * hash2[i + 1] * 31 % 1000000009 + t[i] - 'a' + 1) % 1000000009;
  }
  for (int i = b.length() - 1; i >= 0; i--) {
    hash1B = (1LL * hash1B * 43 % 1000000007 + b[i] - 'a' + 1) % 1000000007;
    hash2B = (1LL * hash2B * 31 % 1000000009 + b[i] - 'a' + 1) % 1000000009;
  }
  for (int i = e.length() - 1; i >= 0; i--) {
    hash1E = (1LL * hash1E * 43 % 1000000007 + e[i] - 'a' + 1) % 1000000007;
    hash2E = (1LL * hash2E * 31 % 1000000009 + e[i] - 'a' + 1) % 1000000009;
  }
}
pair<int, int> getHash(int l, int r) {
  pair<int, int> ret;
  int len = r - l + 1;
  ret.first =
      (hash1[l] - 1LL * hash1[r + 1] * power1[len] % 1000000007 + 1000000007) %
      1000000007;
  ret.second =
      (hash2[l] - 1LL * hash2[r + 1] * power2[len] % 1000000009 + 1000000009) %
      1000000009;
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> t >> b >> e;
  power1[0] = power2[0] = 1;
  for (int i = 1; i < N; i++) {
    power1[i] = 1LL * power1[i - 1] * 43 % 1000000007;
    power2[i] = 1LL * power2[i - 1] * 31 % 1000000009;
  }
  buildHash();
  vector<int> start, en;
  for (int i = 0; i < t.length(); i++) {
    if (i + b.length() <= t.length()) {
      if (getHash(i, i + b.length() - 1) == make_pair(hash1B, hash2B))
        start.push_back(i);
    }
    if (i + e.length() <= t.length()) {
      if (getHash(i, i + e.length() - 1) == make_pair(hash1E, hash2E))
        en.push_back(i);
    }
  }
  vector<pair<int, int> > s;
  int lastStart = 0;
  for (int i = 0; i < start.size(); i++) {
    bool first = true;
    for (int j = lastStart; j < en.size(); j++) {
      if (first) first = false, lastStart = j;
      if (en[j] < start[i]) continue;
      int len = en[j] + e.length() - start[i];
      if (len >= max(b.length(), e.length())) {
        s.push_back(getHash(start[i], start[i] + len - 1));
      }
    }
    if (first) break;
  }
  sort(s.begin(), s.end());
  int ans = s.size();
  for (int i = 1; i < s.size(); i++)
    if (s[i] == s[i - 1]) ans--;
  cout << ans;
}
