#include <bits/stdc++.h>
using namespace std;
long long fans = 0;
unordered_map<unsigned long long, int> m;
int len;
char s[2015];
char s1[2015];
char s2[2015];
unsigned long long hass[2015];
void hashh() {
  int n = strlen(s);
  hass[0] = s[0];
  for (int i = 1; i < n; i++) {
    hass[i] = hass[i - 1] * 131 + s[i];
  }
}
unsigned long long base[2015];
void getbase() {
  base[0] = 1;
  int n = strlen(s);
  for (int i = 1; i <= n; i++) {
    base[i] = base[i - 1] * 131;
  }
}
unsigned long long getLR(int l, int r) {
  if (l == 0) return hass[r];
  return hass[r] - hass[l - 1] * base[r - l + 1];
}
vector<int> v1;
vector<int> v2;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> s >> s1 >> s2;
  len = strlen(s);
  int len1 = strlen(s1);
  int len2 = strlen(s2);
  hashh();
  getbase();
  unsigned long long t1 = 0;
  for (int i = 0; i < len1; i++) {
    t1 = t1 * 131 + s1[i];
  }
  unsigned long long t2 = 0;
  for (int i = 0; i < len2; i++) {
    t2 = t2 * 131 + s2[i];
  }
  for (int i = len1 - 1; i < len; i++) {
    if (getLR(i - len1 + 1, i) == t1) v1.push_back(i - len1 + 1);
  }
  for (int i = len2 - 1; i < len; i++) {
    if (getLR(i - len2 + 1, i) == t2) v2.push_back(i);
  }
  for (int i = 0; i < v2.size(); i++) {
    for (int j = 0; j < v1.size(); j++) {
      if (v1[j] > v2[i]) break;
      if (v2[i] - v1[j] + 1 < len1 || v2[i] - v1[j] + 1 < len2) break;
      unsigned long long r = getLR(v1[j], v2[i]);
      if (m.count(r) == 0) {
        fans++;
        m[r] = 1;
      }
    }
  }
  cout << fans << endl;
}
