#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x) {
  x = 0;
  char ch = getchar();
  int fh = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') fh = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x *= fh;
}
template <typename T>
void write(T x) {
  if (x < 0) x = -x, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
void writeln(T x) {
  write(x);
  puts("");
}
int ans;
char t[2005];
int tr[2000005][26], idx;
char sbegin[2005], send[2005];
int ne[2005];
void insert(int j) {
  int cur = 0;
  for (int i = j; i <= strlen(t + 1); ++i) {
    if (!tr[cur][t[i] - 'a']) tr[cur][t[i] - 'a'] = ++idx;
    cur = tr[cur][t[i] - 'a'];
  }
}
void dfs(int cur, int mat, int j) {
  if (mat != strlen(sbegin + 1)) {
    if (!tr[cur][sbegin[mat + 1] - 'a']) return;
    while (j && send[j + 1] != sbegin[mat + 1]) j = ne[j];
    if (send[j + 1] == sbegin[mat + 1]) ++j;
    if (j == strlen(send + 1)) {
      if (mat == strlen(sbegin + 1) - 1) ans++;
      j = ne[j];
    }
    dfs(tr[cur][sbegin[mat + 1] - 'a'], mat + 1, j);
  } else {
    for (int i = 0; i < 26; ++i) {
      int tmp = j;
      if (!tr[cur][i]) continue;
      while (j && send[j + 1] != i + 'a') j = ne[j];
      if (send[j + 1] == i + 'a') ++j;
      if (j == strlen(send + 1)) {
        ans++;
        j = ne[j];
      }
      dfs(tr[cur][i], mat, j);
      j = tmp;
    }
  }
}
signed main() {
  cin >> t + 1 >> sbegin + 1 >> send + 1;
  for (int i = strlen(t + 1); i >= 1; --i) insert(i);
  for (int i = 2, j = 0; i <= strlen(send + 1); ++i) {
    while (j && send[i] != send[j + 1]) j = ne[j];
    if (send[i] == send[j + 1]) ++j;
    ne[i] = j;
  }
  dfs(0, 0, 0);
  cout << ans << endl;
  return 0;
}
