#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
long long p1[2005], p2[2005], ha1[2005], ha2[2005], hb1[2005], hb2[2005],
    hs1[2005], hs2[2005];
string s, a, b;
vector<pair<int, int>> sets;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> s >> a >> b;
  p1[0] = p2[0] = 1;
  for (int i = 1; i <= 2000; i++) {
    p1[i] = (p1[i - 1] * 31LL) % MOD;
    p2[i] = (p2[i - 1] * 67LL) % MOD;
  }
  for (int i = 1; i <= a.size(); i++) {
    ha1[i] = (ha1[i - 1] + (a[i - 1] * p1[i - 1] % MOD)) % MOD;
    ha2[i] = (ha2[i - 1] + (a[i - 1] * p2[i - 1] % MOD)) % MOD;
  }
  for (int i = 1; i <= b.size(); i++) {
    hb1[i] = (hb1[i - 1] + (b[i - 1] * p1[i - 1] % MOD)) % MOD;
    hb2[i] = (hb2[i - 1] + (b[i - 1] * p2[i - 1] % MOD)) % MOD;
  }
  int mx = max(a.size(), b.size());
  for (int i = 1; i <= s.size(); i++) {
    for (int j = 1; i + j - 1 <= s.size(); j++) {
      hs1[j] = (hs1[j - 1] + (s[i + j - 2] * p1[j - 1] % MOD)) % MOD;
      hs2[j] = (hs2[j - 1] + (s[i + j - 2] * p2[j - 1] % MOD)) % MOD;
      if (j >= mx || j >= a.size()) {
        long long pref1 = hs1[a.size()];
        long long pref2 = hs2[a.size()];
        if (pref1 != ha1[a.size()] && pref2 != ha2[a.size()]) {
          break;
        }
        if (j < mx) {
          continue;
        }
        long long suff1 = (hs1[j] - hs1[j - b.size()] + MOD) % MOD;
        long long suff2 = (hs2[j] - hs2[j - b.size()] + MOD) % MOD;
        long long cmp1 = hb1[b.size()] * p1[j - b.size()] % MOD;
        long long cmp2 = hb2[b.size()] * p2[j - b.size()] % MOD;
        if (suff1 == cmp1 && suff2 == cmp2) {
          sets.push_back({hs1[j], hs2[j]});
        }
      }
    }
  }
  sort(sets.begin(), sets.end());
  cout << unique(sets.begin(), sets.end()) - sets.begin() << '\n';
  return 0;
}
