#include <bits/stdc++.h>
using namespace std;
string text, sbegin, send;
bool beginmap[2010], endmap[2010];
bool cmp(int a, int b) { return text.substr(a) < text.substr(b); }
void match(const string &text, const string &sub, bool mp[]) {
  vector<int> ans;
  int n = int(text.size()), m = int(sub.size());
  for (int i = 0; i < n; ++i) {
    int k;
    for (k = 0; k < m; ++k) {
      if (i + k >= n || sub[k] != text[i + k]) break;
    }
    if (k >= m) mp[i] = true;
  }
}
int main() {
  cin >> text >> sbegin >> send;
  match(text, sbegin, beginmap);
  match(text, send, endmap);
  int n = int(text.size());
  vector<int> suffix;
  for (int i = 0; i < n; ++i) suffix.push_back(i);
  sort(suffix.begin(), suffix.end(), cmp);
  int ans = 0;
  int k1 = int(sbegin.size()), k2 = int(send.size());
  int lcp[2010] = {0};
  for (int i = 1; i < n; ++i) {
    int k;
    int a = suffix[i - 1], b = suffix[i];
    for (k = 0; a + k < n && b + k < n; ++k) {
      if (text[a + k] != text[b + k]) break;
    }
    lcp[i] = k;
  }
  for (int i = 0; i < n; ++i) {
    int l = max(k1, k2);
    l = max(l, lcp[i] + 1);
    for (; l <= n - suffix[i]; ++l) {
      int begin = suffix[i], end = suffix[i] + l;
      if (beginmap[begin] && endmap[end - k2]) ++ans;
    }
  }
  cout << ans << endl;
}
