#include <bits/stdc++.h>
using namespace std;
char s[2001], a[2001], b[2001];
long long p1 = 1000000000007, p2 = 123123151;
long long a1, a2, b1, b2;
vector<pair<long long, long long> > v;
int l1, l2;
long long po1[2001], po2[2001];
long long pr1[2001], pr2[2001];
vector<int> va, vb;
int main() {
  gets(s);
  gets(a);
  gets(b);
  po1[0] = po2[0] = 1;
  for (int i = 1; i <= 2000; i++)
    po1[i] = po1[i - 1] * p1, po2[i] = po2[i - 1] * p2;
  for (int i = 0; a[i]; i++) {
    l1++;
    a1 = a1 * p1 + a[i];
    a2 = a2 * p2 + a[i];
  }
  for (int i = 0; b[i]; i++) {
    l2++;
    b1 = b1 * p1 + b[i];
    b2 = b2 * p2 + b[i];
  }
  for (int i = 0; s[i]; i++) {
    pr1[i + 1] = pr1[i] * p1 + s[i];
    pr2[i + 1] = pr2[i] * p2 + s[i];
    if (i + 1 >= l1) {
      long long r1 = pr1[i + 1] - pr1[i + 1 - l1] * po1[l1],
                r2 = pr2[i + 1] - pr2[i + 1 - l1] * po2[l1];
      if (r1 == a1 && r2 == a2) va.push_back(i + 1);
    }
    if (i + 1 >= l2) {
      long long r1 = pr1[i + 1] - pr1[i + 1 - l2] * po1[l2],
                r2 = pr2[i + 1] - pr2[i + 1 - l2] * po2[l2];
      if (r1 == b1 && r2 == b2) vb.push_back(i + 1);
    }
  }
  int lst = 0;
  for (int i = 0; i < va.size(); i++) {
    for (int j = lst; j < vb.size(); j++) {
      if (vb[j] < va[i] || va[i] - l1 > vb[j] - l2) {
        lst++;
        continue;
      }
      long long r1 = pr1[vb[j]] - pr1[va[i] - l1] * po1[vb[j] - va[i] + l1],
                r2 = pr2[vb[j]] - pr2[va[i] - l1] * po2[vb[j] - va[i] + l1];
      v.push_back(make_pair(r1, r2));
    }
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  printf("%d", (int)v.size());
  return 0;
}
