#include <bits/stdc++.h>
using namespace std;
string str;
char coco[2001];
unsigned long long nex[26][2001], link[26], n, bits[2001];
unsigned long long has[2][2001], mul[2][2001], bag[2][2001];
unsigned long long M[] = {1000000007, 141650939};
unsigned long long bm(unsigned long long n, unsigned long long p,
                      unsigned long long m) {
  if (p == 0) return 1;
  if (p == 1 || n == 1) return n % m;
  unsigned long long ret = bm(n, p / 2, m);
  ret = (ret * ret) % m;
  if (p % 2) ret = (ret * n) % m;
  return ret % m;
}
unsigned long long modinv(unsigned long long n, unsigned long long p) {
  return bm(n, p - 2, p);
}
void dude(int ck) {
  mul[ck][0] = 1;
  bag[ck][0] = modinv(mul[ck][0], M[ck]);
  for (int i = 1; i <= n - 1; i++) {
    mul[ck][i] = mul[ck][i - 1] * 31;
    mul[ck][i] %= M[ck];
    if (i == 1)
      bag[ck][i] = modinv(mul[ck][i], M[ck]);
    else
      bag[ck][i] = (bag[ck][i - 1] * bag[ck][1]) % M[ck];
  }
}
void info() {
  for (int ck = 0; ck <= 1; ck++) {
    dude(ck);
    unsigned long long c = 0;
    for (int j = 0; j <= n - 1; j++) {
      c += (unsigned long long)bits[j] * mul[ck][j];
      c %= M[ck];
      has[ck][j] = c;
    }
  }
}
pair<unsigned long long, unsigned long long> ran(unsigned long long l,
                                                 unsigned long long r) {
  unsigned long long ret = has[0][r] + M[0];
  if (l) ret -= has[0][l - 1];
  ret %= M[0];
  ret *= bag[0][l];
  ret %= M[0];
  unsigned long long po = has[1][r] + M[1];
  if (l) po -= has[1][l - 1];
  po %= M[1];
  po *= bag[1][l];
  po %= M[1];
  return make_pair(ret, po);
}
pair<unsigned long long, unsigned long long> hashVal(string str) {
  pair<unsigned long long, unsigned long long> ret;
  int n = str.size();
  for (int ck = 0; ck <= 1; ck++) {
    unsigned long long c = 0;
    for (int j = 0; j <= n - 1; j++) {
      unsigned long long v = str[j] - 'a';
      v++;
      c += (unsigned long long)v * mul[ck][j];
      c %= M[ck];
    }
    if (!ck)
      ret.first = c;
    else
      ret.second = c;
  }
  return ret;
}
unsigned long long ohoh[2001 * 2001], tp;
int main() {
  ios::sync_with_stdio(false);
  unsigned long long q, x, l, r, m, o;
  string pre, suf;
  cin >> str;
  n = str.size();
  cin >> pre >> suf;
  m = pre.size();
  o = suf.size();
  for (int i = 0; i <= n - 1; i++) {
    unsigned long long x = str[i] - 'a';
    x++;
    bits[i] = x;
  }
  info();
  pair<unsigned long long, unsigned long long> po = hashVal(pre),
                                               so = hashVal(suf);
  for (int i = 0; i <= n - 1; i++) {
    for (int j = i; j <= n - 1; j++) {
      if (i + m - 1 <= j && j - o + 1 >= i && po == ran(i, i + m - 1) &&
          so == ran(j - o + 1, j)) {
        pair<unsigned long long, unsigned long long> use = ran(i, j);
        ohoh[tp] = (unsigned long long)use.first * 1000000000 + use.second;
        tp++;
      }
    }
  }
  sort(ohoh, ohoh + tp);
  int prin = 0;
  if (tp)
    for (int i = 0; i <= tp - 1; i++) {
      if (i == 0 || ohoh[i] != ohoh[i - 1]) prin++;
    }
  cout << prin << endl;
  return 0;
}
