#include <bits/stdc++.h>
using namespace std;
string a, p, s;
bool suff[2002][2002];
bool pref[2002][2002];
long long int hash1[2002][2002];
long long int hash2[2002][2002];
set<pair<int, int> > ans;
int main() {
  cin >> a >> p >> s;
  long long int mod1 = 1000000007;
  long long int mod2 = 1000003;
  for (int i = 0; i < a.size(); i++) {
    pref[i][p.size() - 1] = (a[i] == p[p.size() - 1]);
    suff[i][s.size() - 1] = (a[i] == s[s.size() - 1]);
  }
  for (int i = p.size() - 2; i >= 0; i--)
    for (int j = 0; j < a.size() - 1; j++)
      pref[j][i] = pref[j + 1][i + 1] && (a[j] == p[i]);
  for (int i = s.size() - 2; i >= 0; i--)
    for (int j = 0; j < a.size() - 1; j++)
      suff[j][i] = suff[j + 1][i + 1] && (a[j] == s[i]);
  int l = max(p.size(), s.size());
  for (int i = 0; i < a.size(); i++) {
    hash1[i][i] = a[i] - 'a';
    hash2[i][i] = 0;
    for (int j = i + 1; j < a.size(); j++) {
      hash1[i][j] = (hash1[i][j - 1] * 26 + a[j] - 'a') % mod1;
      hash2[i][j] = j - i;
    }
  }
  for (int i = 0; i < a.size(); i++)
    for (int j = i + l - 1; j < a.size(); j++)
      if (pref[i][0] && suff[j - s.size() + 1][0])
        ans.insert(make_pair(hash1[i][j], hash2[i][j]));
  cout << ans.size() << endl;
  return 0;
}
