#include <bits/stdc++.h>
using namespace std;
char S[2000 + 1];
char SB[2000 + 1];
char SE[2000 + 1];
int sl, sbl, sel;
int PREFIX[2000 + 1];
int SUFFIX[2000 + 1];
struct trie {
  int cdr[26];
  bool used;
} p[2000001];
int tot = 0, ans = 0;
void ins(int now, int pos, int minpos) {
  if (pos > minpos && SUFFIX[pos - 1] && !p[now].used) {
    p[now].used = true;
    ans++;
  }
  if (pos < sl) {
    int next = S[pos] - 'a';
    if (!p[now].cdr[next]) p[now].cdr[next] = ++tot;
    ins(p[now].cdr[next], pos + 1, minpos);
  }
}
int main() {
  cin >> S >> SB >> SE;
  sl = strlen(S);
  sbl = strlen(SB);
  sel = strlen(SE);
  for (int i = (0); i < (sl - sbl + 1); ++i) {
    if (strncmp(S + i, SB, sbl) == 0) PREFIX[i] = 1;
  }
  for (int i = (sel - 1); i < (sl); ++i) {
    if (strncmp(S + i - sel + 1, SE, sel) == 0) SUFFIX[i] = 1;
  }
  int minlen = max(sbl, sel);
  for (int i = (0); i < (sl); ++i)
    if (PREFIX[i]) ins(0, i, i + minlen - 1);
  cout << ans << endl;
  return 0;
}
