#include <bits/stdc++.h>
using namespace std;
string s[5];
int dp[5][2004];
long long mod[] = {1000000003, 1000000005};
int ck(int idx, int f) {
  if (f == 0) {
    if (s[0].size() < s[1].size() + idx) return 0;
    for (int i = idx, j = 0; j < s[1].size(); j++, i++) {
      if (s[0][i] != s[1][j]) return 0;
    }
    return 1;
  } else {
    if (idx - s[2].size() + 1 < 0) return 0;
    for (int i = idx - s[2].size() + 1, j = 0; j < s[2].size(); j++, i++) {
      if (s[0][i] != s[2][j]) return 0;
    }
    return 1;
  }
}
vector<pair<long long, long long> > ans;
int main() {
  cin >> s[0] >> s[1] >> s[2];
  int n = s[0].size();
  for (int i = 0; i < n; i++) {
    dp[0][i] = ck(i, 0);
    dp[1][i] = ck(i, 1);
  }
  for (int i = 0; i < n; i++) {
    if (dp[0][i] == 1) {
      long long u = 0, v = 0;
      for (int j = i; j < n; j++) {
        u = (26LL * u + s[0][j] - 'a' + 1) % mod[0];
        v = (26LL * v + s[0][j] - 'a') % mod[1];
        if (dp[1][j] == 1 && j >= max(i + s[1].size() - 1, i + s[2].size() - 1))
          ans.push_back(make_pair(u, v));
      }
    }
  }
  sort(ans.begin(), ans.end());
  auto it = unique(ans.begin(), ans.end());
  ans.resize(distance(ans.begin(), it));
  cout << ans.size() << endl;
  return 0;
}
