#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
string a, b, t;
bool canStart[N], canEnd[N];
long long H[N][2];
long long P[N][2];
map<unsigned long long, bool> ma;
bool f[N];
int MOD[] = {(int)1000003909, (int)1000000021};
long long base = 90000000019;
long long h[2];
void getH(int L, int R) {
  for (int j = 0; j < 2; j++) {
    h[j] = (H[R + 1][j] - H[L][j] * P[R - L + 1][j] + MOD[j]) % MOD[j];
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  cin >> t >> a >> b;
  int n = (int)t.size(), na = (int)a.size(), nb = (int)b.size();
  P[0][1] = P[0][0] = 1;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 2; j++) {
      P[i][j] = P[i - 1][j] * base % MOD[j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2; j++) {
      H[i + 1][j] = (H[i][j] * base + t[i] - 'a' + 1) % MOD[j];
    }
  }
  for (int i = n - 1; i - nb + 1 >= 0; i--) {
    bool good = true;
    for (int j = 0; j < nb; j++) {
      good &= t[i - j] == b[nb - 1 - j];
    }
    f[i] = good;
  }
  for (int i = 0; i + na <= n; i++) {
    canStart[i] = true;
    for (int j = i; j < i + na; j++) {
      if (t[j] != a[j - i]) {
        canStart[i] = false;
        break;
      }
    }
  }
  for (int i = n - 1; i - nb + 1 >= 0; i--) {
    canEnd[i] = true;
    for (int j = i, c = nb - 1; j >= i - nb + 1; j--, c--) {
      if (t[j] != b[c]) {
        canEnd[i] = false;
        break;
      }
    }
  }
  unordered_set<unsigned long long> ST;
  int maxi = max(na, nb);
  for (int s = 0; s < n; s++) {
    if (!canStart[s]) continue;
    unsigned long long curHash = 0;
    for (int e = s; e < n; e++) {
      int sz = e - s + 1;
      curHash = curHash * base + t[e];
      if (!canEnd[e] || sz < maxi) continue;
      ST.insert(curHash);
    }
  }
  cout << ST.size() << '\n';
  return 0;
}
