#include <bits/stdc++.h>
using namespace std;
const long long N = 2505ll;
const long long A = 31ll;
const long long B = 1000000007ll;
long long h[N];
string t, s1, s2;
long long poww[N];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> t >> s1 >> s2;
  poww[0] = 1;
  for (long long i = 1; i < N; i++) poww[i] = poww[i - 1] * A;
  long long hash1, hash2, hash3;
  hash1 = (long long)(s1[0] - 'a' + 1);
  for (long long i = 1; i < s1.size(); i++)
    hash1 += ((long long)(s1[i] - 'a' + 1)) * poww[i];
  hash2 = (long long)(s2[0] - 'a' + 1);
  for (long long i = 1; i < (long long)s2.size(); i++)
    hash2 += ((long long)s2[i] - 'a' + 1) * poww[i];
  h[0] = (long long)(t[0] - 'a' + 1);
  for (long long i = 1; i < (long long)t.size(); i++)
    h[i] = h[i - 1] + ((long long)t[i] - 'a' + 1) * poww[i];
  vector<long long> ans[N];
  for (long long i = 0; i + (long long)s1.size() - 1 < (long long)t.size();
       i++) {
    hash3 = h[i + (long long)s1.size() - 1] - (i > 0 ? h[i - 1] : 0ll);
    if (hash3 == hash1 * poww[i]) {
      for (long long j = i; j + (long long)s2.size() - 1 < (long long)t.size();
           j++) {
        hash3 = h[j + (long long)s2.size() - 1] - (j > 0 ? h[j - 1] : 0ll);
        if (hash3 == hash2 * poww[j] &&
            j + (long long)s2.size() - 1 >= i + (long long)s1.size() - 1) {
          hash3 = h[j + (long long)s2.size() - 1] - (i > 0 ? h[i - 1] : 0ll);
          hash3 *= poww[(long long)t.size() - i];
          ans[j + (long long)s2.size() - i].push_back(hash3);
        }
      }
    }
  }
  long long ans2 = 0;
  for (long long i = 0; i < N; i++) {
    sort(ans[i].begin(), ans[i].end());
    ans[i].resize(unique(ans[i].begin(), ans[i].end()) - ans[i].begin());
    ans2 += (long long)ans[i].size();
  }
  cout << ans2;
  return 0;
}
