#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
int dxx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
int dyy[] = {0, +1, 0, -1, +1, -1, +1, -1};
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
long long bigMod(long long a, long long b) {
  long long r = 1;
  while (b) {
    if (b & 1) (r *= a) %= 1000000007;
    b >>= 1;
    (a *= a) %= 1000000007;
  }
  return r;
}
long long E1[100007], E2[100007];
struct Hash {
  int len;
  pair<long long, long long> h[100007];
  Hash() {
    len = 0;
    h[0] = {0, 0};
  }
  void in(char ch) {
    ++len;
    h[len].first = (h[len - 1].first * 43 + ch) % 1000000007;
    h[len].second = (h[len - 1].second * 43 + ch) % 1000000009;
  }
  pair<long long, long long> sub(int l, int r) {
    int L = r - l + 1;
    pair<long long, long long> ret;
    ret.first =
        ((h[r].first - h[l - 1].first * E1[L]) % 1000000007 + 1000000007) %
        1000000007;
    ret.second =
        ((h[r].second - h[l - 1].second * E2[L]) % 1000000009 + 1000000009) %
        1000000009;
    return ret;
  }
};
Hash h1, h2, h3;
int cnt;
char a[2007], b[2007], c[2007];
vector<pair<long long, long long> > v;
int main() {
  int i, j, la, lb, lc;
  E1[0] = E2[0] = 1;
  for (i = 1; i < 100007; i++) {
    E1[i] = (E1[i - 1] * 43) % 1000000007;
    E2[i] = (E2[i - 1] * 43) % 1000000009;
  }
  scanf("%s %s %s", &a[1], &b[1], &c[1]);
  la = strlen(&a[1]);
  lb = strlen(&b[1]);
  lc = strlen(&c[1]);
  for (i = 1; a[i]; i++) h1.in(a[i]);
  for (i = 1; b[i]; i++) h2.in(b[i]);
  for (i = 1; c[i]; i++) h3.in(c[i]);
  for (i = 1; i <= la - lb + 1; i++) {
    for (j = i; j <= la - lc + 1; j++) {
      if (h1.sub(i, i + lb - 1) == h2.h[lb] &&
          h1.sub(j, j + lc - 1) == h3.h[lc])
        if (i + lb - 1 <= j + lc - 1) v.push_back(h1.sub(i, j + lc - 1));
    }
  }
  sort(v.begin(), v.end());
  for (i = 1, j = v.size(), cnt = j ? 1 : 0; i < j; i++)
    if (v[i] != v[i - 1]) cnt++;
  printf("%d\n", cnt);
  return 0;
}
