#include <bits/stdc++.h>
using namespace std;
const unsigned long long magic = 37;
const long long magic2 = 97;
const long long base = 1e9 + 7;
unsigned long long pw[2005], h[2005];
long long pw2[2005], hh[2005];
char s[2005], l[2005], r[2005];
vector<pair<unsigned long long, long long> > ans;
inline pair<unsigned long long, long long> getValue(int l, int r) {
  return make_pair(h[r + 1] - h[l] * pw[r - l + 1],
                   (hh[r + 1] - (hh[l] * pw2[r - l + 1]) % base + base) % base);
}
inline bool equal(int l, int r, unsigned long long h1, long long h2) {
  return getValue(l, r) == make_pair(h1, h2);
}
int main() {
  cin >> s >> l >> r;
  int l1 = strlen(l), l2 = strlen(r), n = strlen(s);
  pw[0] = pw2[0] = 1;
  for (int i = 1; i <= n; i++) {
    pw[i] = pw[i - 1] * magic;
    pw2[i] = pw2[i - 1] * magic2 % base;
  }
  unsigned long long h1 = 0, h2 = 0;
  long long hh1 = 0, hh2 = 0;
  for (int i = 0; l[i]; i++) {
    h1 = h1 * magic + l[i] - 'a' + 1;
    hh1 = (hh1 * magic2 + l[i] - 'a' + 1) % base;
  }
  for (int i = 0; r[i]; i++) {
    h2 = h2 * magic + r[i] - 'a' + 1;
    hh2 = (hh2 * magic2 + r[i] - 'a' + 1) % base;
  }
  for (int i = 0; i < n; i++) {
    h[i + 1] = h[i] * magic + s[i] - 'a' + 1;
    hh[i + 1] = (hh[i] * magic2 + s[i] - 'a' + 1) % base;
  }
  int len = max(l1, l2);
  ans.clear();
  for (int st = 0; st < n; st++) {
    for (int ed = st + len - 1; ed < n; ed++) {
      int l = st, r = l + l1 - 1;
      if (equal(l, r, h1, hh1)) {
        r = ed, l = ed - l2 + 1;
        if (equal(l, r, h2, hh2)) {
          ans.push_back(getValue(st, ed));
        }
      }
    }
  }
  sort(ans.begin(), ans.end());
  ans.erase(unique(ans.begin(), ans.end()), ans.end());
  cout << ans.size();
  return 0;
}
