#include <bits/stdc++.h>
using namespace std;
const int N = 4005;
const int M = 200005;
string a, s, t, st;
vector<long long> x[N];
long long h[M], pw[M];
int g1[M], g2[M];
long long gethash(int i, int j) {
  return (h[j + 1] - h[i]) * pw[a.size() - j + 1];
}
int main() {
  pw[0] = 1;
  for (int i = 1; i < N; i++) {
    pw[i] = pw[i - 1] * 29;
  }
  cin >> a >> s >> t;
  int l = a.length();
  int l1 = s.length();
  int l2 = t.length();
  for (int i = 1; i <= l; i++) {
    h[i] = h[i - 1] + a[i - 1] * pw[i];
  }
  for (int i = 0; i <= l - l1; i++) {
    int f = 0;
    for (int j = 0; j < l1; j++) {
      if (s[j] != a[i + j]) {
        f++;
        break;
      }
    }
    if (f == 0) g1[i] = 1;
  }
  for (int i = 0; i <= l - l2; i++) {
    int f = 0;
    for (int j = 0; j < l2; j++) {
      if (t[j] != a[i + j]) {
        f++;
        break;
      }
    }
    if (f == 0) g2[i + l2 - 1] = 1;
  }
  int len = max(l1, l2);
  for (int i = 0; i < l; i++) {
    for (int j = 0; j < l; j++) {
      if (g1[i] && g2[j] && j - i + 1 >= len) {
        x[j - i + 1].push_back(gethash(i, j));
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= l; i++) {
    sort(x[i].begin(), x[i].end());
    if (x[i].size()) ans++;
    for (int j = 1; j < x[i].size(); j++) {
      if (x[i][j] != x[i][j - 1]) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
