#include <bits/stdc++.h>
using namespace std;
double eps = 1e-9;
const int INF = 1e9 + 7;
const int MAXN = int(2e5 + 7);
int n, n1, n2, ans, p[2007], pw[2007], a[2007], b[2007], base = 31;
set<int> st[2007];
string second, t1, t2;
int main() {
  cin >> second >> t1 >> t2;
  n = second.size(), n1 = t1.size(), n2 = t2.size();
  pw[0] = 1;
  for (int i = 0; i < n; i++) {
    if (i) pw[i] = pw[i - 1] * base;
    if (i) p[i] = p[i - 1] * base;
    p[i] += (second[i] - 'a' + 1);
  }
  for (int i = 0; i < n - n1 + 1; i++)
    if (second.substr(i, n1) == t1) a[i] = 1;
  for (int i = 0; i < n - n2 + 1; i++)
    if (second.substr(i, n2) == t2) b[i] = 1;
  for (int i = 0; i < n; i++) {
    if (!a[i]) continue;
    for (int j = i; j < n; j++) {
      if (!b[j] || i + n1 > j + n2) continue;
      int r = j + n2 - 1, l = i - 1, len = r - l;
      st[len].insert(p[r] - p[l] * pw[len]);
    }
  }
  for (int i = 1; i < 2007; i++) ans += st[i].size();
  cout << ans;
  return 0;
}
