#include <bits/stdc++.h>
using namespace std;
template <typename T>
T mod(T x, T m) {
  T res = x % m;
  return res >= 0 ? res : res + m;
}
template <typename T>
T gcd(T a, T b) {
  return b == 0 ? abs(a) : gcd(b, a % b);
}
void scint(int32_t &result) {
  bool minus = false;
  result = 0;
  char ch;
  ch = getchar();
  while (true) {
    if (ch == '-') break;
    if (ch >= '0' && ch <= '9') break;
    ch = getchar();
  }
  if (ch == '-')
    minus = true;
  else
    result = ch - '0';
  while (true) {
    ch = getchar();
    if (ch < '0' || ch > '9') break;
    result = result * 10 + (ch - '0');
  }
  if (minus) result *= -1;
}
class pair_hash {
 public:
  inline size_t operator()(const pair<int32_t, int32_t> &v) const {
    return ((v.first * 31) + v.second);
  }
};
string str, s1, s2, _s1, _s2;
int32_t l, l1, l2;
vector<int32_t> z1, z2;
vector<int32_t> v1, v2;
vector<vector<pair<int32_t, int32_t>>> HASH;
void generateZArray() {
  for (int32_t i = 1, low = 0, high = 0; i < l + l1 + 1; i++) {
    if (i <= high) z1[i] = min(z1[i - low], high - i + 1);
    while (i + z1[i] < l + l1 + 1 && _s1[z1[i]] == _s1[i + z1[i]]) z1[i]++;
    if (i + z1[i] - 1 > high) {
      high = i + z1[i] - 1;
      low = i;
    }
  }
  for (int32_t i = 1, low = 0, high = 0; i < l + l2 + 1; i++) {
    if (i <= high) z2[i] = min(z2[i - low], high - i + 1);
    while (i + z2[i] < l + l2 + 1 && _s2[z2[i]] == _s2[i + z2[i]]) z2[i]++;
    if (i + z2[i] - 1 > high) {
      high = i + z2[i] - 1;
      low = i;
    }
  }
}
void solve(int32_t testCase) {
  cin >> str >> s1 >> s2;
  l = str.length();
  l1 = s1.length(), l2 = s2.length();
  z1.assign(l + l1 + 1, 0);
  z2.assign(l + l2 + 1, 0);
  _s1 = s1 + "$" + str;
  _s2 = s2 + "$" + str;
  HASH.assign(l, vector<pair<int32_t, int32_t>>(l));
  generateZArray();
  for (int32_t i = 0; i < z1.size(); i++) {
    if (z1[i] == l1) {
      v1.push_back(i - l1 - 1);
    }
  }
  for (int32_t i = 0; i < z2.size(); i++) {
    if (z2[i] == l2) {
      v2.push_back(i - l2 - 1);
    }
  }
  int32_t m1 = 1e9 + 7, m2 = 1e9 + 21;
  int32_t p1 = 31, p2 = 37;
  for (int32_t i = 0; i < l; i++) {
    int32_t h1 = 0, h2 = 0;
    int32_t pow1 = 1, pow2 = 1;
    for (int32_t j = i; j < l; j++) {
      h1 = h1 + (((str[j] - 'a' + 1) * pow1) % m1 + m1) % m1;
      h2 = h2 + (((str[j] - 'a' + 1) * pow2) % m2 + m2) % m2;
      pow1 = ((pow1 * p1) % m1 + m1) % m1;
      pow2 = ((pow2 * p2) % m2 + m2) % m2;
      HASH[i][j] = {h1, h2};
    }
  }
  unordered_set<pair<int32_t, int32_t>, pair_hash> hs;
  for (int32_t i = 0; i < v1.size(); i++) {
    for (int32_t j = 0; j < v2.size(); j++) {
      if (v2[j] >= v1[i] && v2[j] + l2 >= v1[i] + l1) {
        hs.insert(HASH[v1[i]][v2[j]]);
      }
    }
  }
  cout << hs.size() << '\n';
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int32_t testCase = 1;
  for (int32_t test = 1; test <= testCase; test++) solve(test);
  return 0;
}
