#include <bits/stdc++.h>
using namespace std;
const int N = 2001;
const int base = 27;
int p1 = (1e9) + 7;
int p2 = (1e9) + 9;
char a[N], b[N], c[N];
pair<int, int> Ahash[N][N];
vector<pair<int, int> > s;
int main() {
  scanf("%s%s%s", a, b, c);
  int n = strlen(a);
  int m = strlen(b);
  int k = strlen(c);
  if (max(m, k) > n) {
    puts("0");
    return 0;
  }
  long long v1, v2;
  for (int i = 0; i < n; ++i) {
    v1 = v2 = 0;
    for (int j = i; j < n; ++j) {
      v1 = (v1 * base + a[j] - 'a' + 1) % p1;
      v2 = (v2 * base + a[j] - 'a' + 1) % p2;
      Ahash[i][j] = make_pair(v1, v2);
    }
  }
  v1 = v2 = 0;
  pair<int, int> B, C;
  for (int i = 0; i < m; ++i) {
    v1 = (v1 * base + b[i] - 'a' + 1) % p1;
    v2 = (v2 * base + b[i] - 'a' + 1) % p2;
  }
  B = make_pair(v1, v2);
  v1 = v2 = 0;
  for (int i = 0; i < k; ++i) {
    v1 = (v1 * base + c[i] - 'a' + 1) % p1;
    v2 = (v2 * base + c[i] - 'a' + 1) % p2;
  }
  C = make_pair(v1, v2);
  for (int i = 0; i + m - 1 < n; ++i) {
    if (Ahash[i][i + m - 1] == B) {
      for (int j = i; j + k - 1 < n; ++j) {
        if (Ahash[j][j + k - 1] == C && j + k - 1 >= i + m - 1)
          s.push_back(Ahash[i][j + k - 1]);
      }
    }
  }
  sort(s.begin(), s.end());
  n = unique(s.begin(), s.end()) - s.begin();
  cout << n << endl;
}
