#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 100;
const int c = 67;
const long long mod = 1e9 + 7;
long long n, h[N], bh, eh, cp[N], ans;
int ssz, bsz, esz;
string s, b, e;
unordered_map<long long, bool> mark[N];
bool found(int i) {
  if (i + bsz > ssz) return 0;
  for (int j = i; j < bsz + i; j++)
    if (s[j] != b[j - i]) return 0;
  return 1;
}
long long hsh(int l, int r) {
  if (!l) return h[r];
  l--;
  return (h[r] - (h[l] * cp[r - l]) % mod + mod) % mod;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> s >> b >> e;
  ssz = s.size();
  bsz = b.size();
  esz = e.size();
  h[0] = s[0];
  for (int i = 1; i < ssz; i++) h[i] = (h[i - 1] * c + s[i]) % mod;
  cp[0] = 1;
  for (int i = 1; i < max(ssz, max(bsz, esz)) + 10; i++)
    cp[i] = (cp[i - 1] * c) % mod;
  for (int i = 0; i < bsz; i++) bh = (bh * c + b[i]) % mod;
  for (int i = 0; i < esz; i++) eh = (eh * c + e[i]) % mod;
  for (int i = 0; i < ssz; i++)
    if (found(i))
      for (int j = i + max(bsz, esz) - 1; j < ssz; j++)
        if (eh == hsh(j - esz + 1, j)) {
          int w = hsh(i, j);
          if (!mark[j - i + 1][w]) ans++, mark[j - i + 1][w] = 1;
        }
  cout << ans << endl;
}
