#include <bits/stdc++.h>
using namespace std;
const int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int dy[8] = {-1, 0, 1, -1, 1, 0, 1, -1};
const int mod[2] = {1000000007, 1000000009};
const int p[2] = {29, 31};
const int maxn = 3000;
int add(int a, int b, int k) {
  return a + b >= mod[k] ? a + b - mod[k] : a + b;
}
int mul(int a, int b, int k) { return 1LL * a * b % mod[k]; }
int sub(int a, int b, int k) { return a < b ? a - b + mod[k] : a - b; }
int pwr(int a, int k, int i) {
  int res = 1;
  while (k) {
    if (k % 2) res = mul(res, a, i);
    a = mul(a, a, i);
    k /= 2;
  }
  return res;
}
int invmod(int a, int k) { return pwr(a, mod[k] - 2, k); }
int H[2][maxn], pinv[2][maxn];
pair<int, int> hsb, hse;
string t, sb, se;
pair<int, int> h(string a) {
  for (int k = 0; k < 2; ++k) {
    int pp = 1;
    for (int i = 0; i < a.size(); ++i) {
      H[k][i] = mul(a[i] - 'a' + 1, pp, k), pp = mul(pp, p[k], k);
      if (i) H[k][i] = add(H[k][i - 1], H[k][i], k);
    }
  }
  return {H[0][a.size() - 1], H[1][a.size() - 1]};
}
pair<int, int> f(int i, int j) {
  return {mul(pinv[0][i], i ? sub(H[0][j], H[0][i - 1], 0) : H[0][j], 0),
          mul(pinv[1][i], i ? sub(H[1][j], H[1][i - 1], 1) : H[1][j], 1)};
}
vector<int> x, y;
vector<pair<int, int> > M;
int main() {
  for (int k = 0; k < 2; ++k) {
    pinv[k][0] = 1;
    pinv[k][1] = invmod(p[k], k);
    for (int i = 2; i < maxn; ++i)
      pinv[k][i] = mul(pinv[k][i - 1], pinv[k][1], k);
  }
  cin >> t >> sb >> se;
  hsb = h(sb);
  hse = h(se);
  h(t);
  int cnt = 0, a = sb.size(), b = se.size(), c = t.size();
  for (int i = 0; i + a - 1 < c; ++i)
    if (hsb == f(i, i + a - 1)) x.push_back(i);
  for (int i = 0; i + b - 1 < c; ++i)
    if (hse == f(i, i + b - 1)) y.push_back(i);
  for (int i : x)
    for (int j : y)
      if (i <= j && i + a <= j + b) M.push_back(f(i, j + b - 1));
  sort(M.begin(), M.end());
  int res = M.size() != 0;
  for (int i = 1; i < M.size(); ++i) res += (M[i] != M[i - 1]);
  cout << res << '\n';
}
