#include <bits/stdc++.h>
using namespace std;
long long int Mod[4] = {381330049, 906528677, 567534853, 497895331};
long long int Prime[4] = {17, 23, 89, 41};
long long int Inv[4][2005];
long long int Pow[4][2005];
long long int BH[4], EH[4];
long long int TH[4][2005];
long long int bigMod(long long int n, long long int r, long long int MOD) {
  if (r == 0) return 1LL;
  long long int ret = bigMod(n, r / 2, MOD);
  ret = (ret * ret) % MOD;
  if (r % 2 == 1) ret = (ret * n) % MOD;
  return ret;
}
long long int Val[4];
vector<pair<long long int,
            pair<long long int, pair<long long int, long long int> > > >
    SET;
int main() {
  Pow[0][0] = Pow[1][0] = Pow[2][0] = 1;
  for (int i = 1; i < 2005; i++)
    for (int j = 0; j < 4; j++) Pow[j][i] = (Pow[j][i - 1] * Prime[j]) % Mod[j];
  for (int i = 0; i < 2005; i++)
    for (int j = 0; j < 4; j++)
      Inv[j][i] = bigMod(Pow[j][i], Mod[j] - 2, Mod[j]);
  string T, B, E;
  cin >> T >> B >> E;
  T = "0" + T;
  B = "0" + B;
  E = "0" + E;
  for (int i = 1; i < B.size(); i++)
    for (int j = 0; j < 4; j++) {
      BH[j] += Pow[j][i] * (B[i] - 'a' + 1);
      BH[j] %= Mod[j];
    }
  for (int i = 1; i < E.size(); i++)
    for (int j = 0; j < 4; j++) {
      EH[j] += Pow[j][i] * (E[i] - 'a' + 1);
      EH[j] %= Mod[j];
    }
  for (int i = 1; i < T.size(); i++)
    for (int j = 0; j < 4; j++) {
      TH[j][i] = TH[j][i - 1] + Pow[j][i] * (T[i] - 'a' + 1);
      TH[j][i] %= Mod[j];
    }
  int t = T.size() - 1;
  int b = B.size() - 1;
  int e = E.size() - 1;
  for (int i = 1; i <= t - b + 1; i++) {
    bool matched = true;
    for (int j = 0; j < 4; j++) {
      long long int Hash = (TH[j][i + b - 1] - TH[j][i - 1] + Mod[j]) % Mod[j];
      Hash = (Hash * Inv[j][i - 1]) % Mod[j];
      if (Hash != BH[j]) matched = false;
    }
    if (!matched) continue;
    for (int p = i; p <= t - e + 1; p++) {
      matched = true;
      for (int j = 0; j < 4; j++) {
        long long int Hash =
            (TH[j][p + e - 1] - TH[j][p - 1] + Mod[j]) % Mod[j];
        Hash = (Hash * Inv[j][p - 1]) % Mod[j];
        if (Hash != EH[j]) matched = false;
      }
      if (!matched) continue;
      if (i + b - 1 > p + e - 1) continue;
      for (int j = 0; j < 4; j++) {
        Val[j] = (TH[j][p + e - 1] - TH[j][i - 1] + Mod[j]) % Mod[j];
        Val[j] = (Val[j] * Inv[j][i - 1]) % Mod[j];
      }
      SET.push_back(
          make_pair(Val[0], make_pair(Val[1], make_pair(Val[2], Val[3]))));
    }
  }
  sort(SET.begin(), SET.end());
  cout << unique(SET.begin(), SET.end()) - SET.begin() << endl;
}
