#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
struct Node {
  bool mark;
  Node *next[27];
  Node() {
    mark = false;
    for (int i = (0); i <= (26); i++) next[i] = NULL;
  }
} * Root;
bool Start[2005], End[2005];
char S[2005], A[2005], B[2005];
int FA[2005], FB[2005];
int Back;
int main() {
  scanf("%s%s%s", S, A, B);
  int la = strlen(A);
  int lb = strlen(B);
  int ls = strlen(S);
  FA[0] = -1;
  FA[1] = 0;
  for (int i = (2); i <= (la); i++) {
    int m = FA[i - 1];
    while (m >= 0 && A[m] != A[i - 1]) m = FA[m];
    FA[i] = m + 1;
  }
  FB[0] = -1;
  FB[1] = 0;
  for (int i = (2); i <= (lb); i++) {
    int m = FB[i - 1];
    while (m >= 0 && B[m] != B[i - 1]) m = FB[m];
    FB[i] = m + 1;
  }
  int m = 0;
  for (int i = (0); i <= (ls - 1); i++) {
    while (S[i] != A[m] && m >= 0) m = FA[m];
    m++;
    if (m == la) {
      Start[i - la + 1] = true;
      m = FA[m];
    }
  }
  m = 0;
  for (int i = (0); i <= (ls - 1); i++) {
    while (S[i] != B[m] && m >= 0) m = FB[m];
    m++;
    if (m == lb) {
      End[i] = true;
      m = FB[m];
    }
  }
  int add = max(la, lb) - 1, ans = 0;
  Root = new Node();
  for (int l = (0); l <= (ls - 1); l++) {
    Node *n = Root;
    if (!Start[l]) continue;
    for (int r = (l + add); r <= (ls - 1); r++) {
      if (n->next[S[r] - 'a'] == NULL) n->next[S[r] - 'a'] = new Node();
      n = n->next[S[r] - 'a'];
      if (!End[r]) continue;
      if (!n->mark) ans++;
      n->mark = true;
    }
  }
  cout << ans;
}
