#include <bits/stdc++.h>
using namespace std;
int Rank[30][4010];
int SuffixArray[4010];
int LCP[4010];
struct entry {
  int A[2];
  int pos;
};
entry Temp[4010];
char str[4010];
bool way(entry x, entry y) {
  return (x.A[0] == y.A[0]) ? (x.A[1] < y.A[1] ? true : false)
                            : (x.A[0] < y.A[0] ? true : false);
}
int step, cnt;
int N;
void BuildSuffixArray(void) {
  for (int i = 0; i < N; i++) Rank[0][i] = str[i] - 'a';
  for (step = 1, cnt = 1; (cnt >> 1) < N; step++, (cnt <<= 1)) {
    for (int i = 0; i < N; i++) {
      Temp[i].A[0] = Rank[step - 1][i];
      Temp[i].A[1] = (i + cnt < N) ? Rank[step - 1][i + cnt] : -1000000007;
      Temp[i].pos = i;
    }
    sort(Temp, Temp + N, way);
    for (int i = 0; i < N; i++) {
      Rank[step][Temp[i].pos] = (i > 0 and Temp[i].A[0] == Temp[i - 1].A[0] and
                                 Temp[i].A[1] == Temp[i - 1].A[1])
                                    ? Rank[step][Temp[i - 1].pos]
                                    : i;
    }
  }
  for (int i = 0; i < N; i++) SuffixArray[i] = Temp[i].pos;
  step--;
}
void BuildLCPArray(void) {
  for (int i = 0, l = 0; i < N; i++) {
    if (Rank[step][i] != N - 1) {
      for (int j = SuffixArray[Rank[step][i] + 1];
           j + l < N and i + l < N and str[i + l] == str[j + l];)
        l++;
      LCP[Rank[step][i]] = l;
      if (l) l--;
    }
  }
}
int lcp(int x, int y) {
  if (x == y) return N - x;
  int ret = 0;
  for (int i = step; i >= 0 and x < N and y < N; i--) {
    if (Rank[i][x] == Rank[i][y]) x += (1 << i), y += (1 << i), ret += (1 << i);
  }
  return ret;
}
int RMQ[30][4010];
void BuildRMQ(void) {
  for (int i = 0; i < N - 1; i++) {
    RMQ[0][i] = LCP[i];
  }
  for (int j = 1; j <= step; j++) {
    for (int i = 0; i < N - 1; i++) {
      if (i + (1 << j) >= N - 1)
        RMQ[j][i] = 1000000007;
      else {
        RMQ[j][i] = min(RMQ[j - 1][i], RMQ[j - 1][i + (1 << j)]);
      }
    }
  }
}
int RMQLCP(int x, int y) {
  int a, b;
  a = Rank[step][x];
  b = Rank[step][y] - 1;
  if (a > b) swap(a, b);
  int smallstep = log2(b - a + 1);
  int ret = min(RMQ[smallstep][a], RMQ[smallstep][b - (1 << smallstep) + 1]);
  return ret;
}
char querystring[4010];
bool Present(int left, int right) {
  if (left > right) return false;
  int mid = (left + right) / 2;
  int pos = SuffixArray[mid];
  int k = strlen(querystring);
  k = min(k, N - pos + 1);
  for (int i = 0; i < k; i++) {
    if (querystring[i] > str[pos + i])
      return Present(mid + 1, right);
    else if (querystring[i] < str[pos + i])
      return Present(left, mid - 1);
  }
  if (N - pos + 1 < strlen(querystring)) return Present(mid + 1, right);
  return true;
}
char sbegin[4010], send[4010];
int counts[4010];
int validstarts[4010], validends[4010];
inline void ReadInput(void) {
  scanf("%s", str);
  scanf("%s", sbegin);
  scanf("%s", send);
}
inline void solve(void) {
  N = strlen(str);
  int N1, N2;
  N1 = strlen(sbegin);
  N2 = strlen(send);
  fill(validstarts, validstarts + 4010, false);
  fill(validends, validends + 4010, false);
  int mmax = 0;
  for (int i = 0; i + N1 - 1 < N; i++) {
    mmax = i;
    int j;
    for (j = i; j < i + N1; j++)
      if (str[j] != sbegin[j - i]) break;
    if (j == i + N1) validstarts[i] = true;
  }
  for (int i = 0; i + N2 - 1 < N; i++) {
    int j;
    for (j = i; j < i + N2; j++)
      if (str[j] != send[j - i]) break;
    if (j == i + N2) validends[i + N2 - 1] = true;
  }
  for (int i = N - 1; i >= 0; i--) {
    if (validends[i]) {
      counts[i] = counts[i + 1] + 1;
    } else
      counts[i] = counts[i + 1];
  }
  BuildSuffixArray();
  BuildLCPArray();
  int ans = 0;
  if (validstarts[SuffixArray[0]])
    ans += counts[SuffixArray[0] + max(N1 - 1, N2 - 1)];
  for (int i = 1; i < N; i++) {
    if (validstarts[SuffixArray[i]]) {
      ans += counts[SuffixArray[i] + max(N1 - 1, max(N2 - 1, LCP[i - 1]))];
    }
  }
  printf("%d\n", ans);
}
inline void Refresh(void) {}
int main() {
  ReadInput();
  solve();
  return 0;
}
