#include <bits/stdc++.h>
using namespace std;
const int MAX = 2 << 10;
char T[MAX], P1[MAX], P2[MAX], aux[MAX << 1];
int L, n, m;
vector<int> primes{
    179424691, 179425033, 179425601, 179426083, 179424697, 179425063, 179425619,
    179426089, 179424719, 179425069, 179425637, 179426111, 179424731, 179425097,
    179425657, 179426123, 179424743, 179425133, 179425661, 179426129, 179424779,
    179425153, 179425693, 179426141, 179424787, 179425171, 179425699, 179426167,
    179424793, 179425177, 179425709, 179426173, 179424797, 179425237, 179425711,
    179426183, 179424799, 179425261, 179425777, 179426231, 179424821, 179425319,
    179425811, 179426239, 179424871, 179425331, 179425817, 179426263, 179424887,
    179425357, 179425819, 179426321, 179424893, 179425373, 179425823, 179426323,
    179424899, 179425399, 179425849, 179426333, 179424907, 179425403, 179425859,
    179426339, 179424911, 179425423, 179425867, 179426341, 179424929, 179425447,
    179425879, 179426353, 179424937, 179425453, 179425889, 179426363, 179424941,
    179425457, 179425907, 179426369, 179424977, 179425517, 179425943, 179426407,
    179424989, 179425529, 179425993, 179426447, 179425003, 179425537, 179426003,
    179426453, 179425019, 179425559, 179426029, 179426491, 179425027, 179425579,
    179426081, 179426549};
int blk = primes.size() / 3;
long long base[3] = {26, 67, 53}, mod[3];
long long POWER[3][MAX], H[3][MAX];
long long target[2][3];
struct qua {
  long long x, y, z;

 public:
  qua() {}
  qua(long long x, long long y, long long z) : x(x), y(y), z(z) {}
  bool operator<(const qua& o) const {
    if (x != o.x) return x < o.x;
    if (y != o.y) return y < o.y;
    return z < o.z;
  }
  bool operator==(const qua& o) const { return !(*this < o) && !(o < *this); }
};
void initH() {
  for (int i = 0; i < (3); i++) {
    int idx = rand() % blk + i * blk;
    mod[i] = primes[idx];
  }
  for (int i = 0; i < (3); i++) POWER[i][0] = 1;
  for (int i = 0; i < (MAX - 1); i++)
    for (int j = 0; j < (3); j++)
      POWER[j][i + 1] = (POWER[j][i] * base[j]) % mod[j];
  long long r[3] = {0};
  for (int i = 0; i < (L); i++) {
    for (int j = 0; j < (3); j++) {
      r[j] = (r[j] * base[j] + T[i] - 'a' + 1) % mod[j];
      H[j][i] = r[j];
    }
  }
  for (int j = 0; j < (3); j++)
    for (int i = 0; i < (n); i++)
      target[0][j] = (target[0][j] * base[j] + P1[i] - 'a' + 1) % mod[j];
  for (int j = 0; j < (3); j++)
    for (int i = 0; i < (m); i++)
      target[1][j] = (target[1][j] * base[j] + P2[i] - 'a' + 1) % mod[j];
}
inline long long getH(int s, int e, int k) {
  long long r = H[k][e];
  if (s) r -= H[k][s - 1] * POWER[k][e - s + 1] % mod[k];
  r = (r % mod[k] + mod[k]) % mod[k];
  return r;
}
bool prefix(int s) {
  for (int i = 0; i < (3); i++)
    if (getH(s, s + n - 1, i) != target[0][i]) return 0;
  return 1;
}
bool suffix(int e) {
  for (int i = 0; i < (3); i++)
    if (getH(e - m + 1, e, i) != target[1][i]) return 0;
  return 1;
}
int main() {
  srand(time(0));
  scanf("%s %s %s", T, P1, P2);
  L = strlen(T), n = strlen(P1), m = strlen(P2);
  initH();
  vector<qua> V;
  for (int i = 0; i < (L); i++) {
    for (int j = i; j < L; j++) {
      if (j - i + 1 >= max(n, m) && prefix(i) && suffix(j))
        V.push_back(qua(getH(i, j, 0), getH(i, j, 1), getH(i, j, 2)));
    }
  }
  sort(V.begin(), V.end());
  cout << unique(V.begin(), V.end()) - V.begin() << endl;
  return 0;
}
