#include <bits/stdc++.h>
using namespace std;
char BUFFER[100000 + 5];
bool readn(int &n) { return scanf("%d", &n) == 1; }
bool readl(unsigned long long &n) { return scanf("%I64d", &n) == 1; }
bool readd(double &n) { return scanf("%lf", &n) == 1; }
bool reads(string &s) {
  s = "";
  int n = scanf("%s", BUFFER);
  if (n == 1) s = BUFFER;
  return n == 1;
}
bool readln(string &s) {
  char *valid = gets(BUFFER);
  if (valid) s = BUFFER;
  return ((bool)valid);
}
const int maxn = 2000 + 5;
const int mod = 4000000;
string s, pre, suf, tmp;
unsigned long long H[maxn][maxn];
set<unsigned long long> x[mod];
bool found1[maxn], found2[maxn];
int ans = 0;
int main() {
  reads(s);
  reads(pre);
  reads(suf);
  memset((found1), (false), sizeof(found1));
  memset((found2), (false), sizeof(found2));
  int i = 0, j = 0, n = max(((int)pre.size()), ((int)suf.size()));
  for (i = 0; i < mod; ++i) x[i].clear();
  if (n > ((int)s.size())) {
    cout << "0\n";
    return 0;
  }
  for (i = 0; i < ((int)s.size()); ++i) {
    i = s.find(pre, i);
    if (i == -1) break;
    found1[i] = true;
  }
  for (i = 0; i < ((int)s.size()); ++i) {
    i = s.find(suf, i);
    if (i == -1) break;
    found2[i + ((int)suf.size()) - 1] = true;
  }
  for (i = 0; i < ((int)s.size()); ++i) {
    H[i][i] = (s[i] - 'a' + 1);
    for (j = i + 1; j < ((int)s.size()); ++j) {
      H[i][j] = H[i][j - 1] * 29;
      H[i][j] += (s[j] - 'a' + 1);
    }
  }
  for (i = 0; i < ((int)s.size()); ++i)
    if (found1[i])
      for (j = (i + n - 1); j < ((int)s.size()); ++j)
        if (found2[j]) {
          x[(int)(H[i][j] % mod)].insert(H[i][j]);
        }
  for (i = 0; i < mod; ++i) ans += ((int)x[i].size());
  cout << ans;
  printf("\n");
  return 0;
}
