#include <bits/stdc++.h>
using namespace std;
const int N = 2000 + 100;
const unsigned long long mod = (1 << 25) - 1;
char s[3][N];
int len[3];
int cnt = 0;
unordered_set<unsigned long long> ust;
unsigned long long H[3][N], p = 1e9 + 7, P[N];
unsigned long long Hash(int k, int l, int len) {
  return H[k][l + len] - H[k][l] * P[len];
}
int main() {
  P[0] = 1;
  for (int i = 1; i < N; ++i) P[i] = P[i - 1] * p;
  for (int i = 0; i < 3; ++i) {
    scanf("%s", s[i]);
    len[i] = strlen(s[i]);
  }
  for (int k = 0; k < 3; ++k) {
    H[k][0] = 0;
    for (int i = 1; i <= len[k]; ++i) H[k][i] = H[k][i - 1] * p + s[k][i - 1];
  }
  for (int i = 0; i + len[1] <= len[0]; ++i)
    if (Hash(0, i, len[1]) == Hash(1, 0, len[1]))
      for (int j = max(i, i + len[1] - len[2]); j + len[2] <= len[0]; ++j)
        if (Hash(0, j, len[2]) == Hash(2, 0, len[2]))
          ust.insert(Hash(0, i, j - i + 1));
  cout << ust.size() << endl;
  return 0;
}
