#include <bits/stdc++.h>
using namespace std;
const int inf(1010101010);
const long long p(10007);
long long hash_simp(string x) {
  long long res(0);
  reverse((x).begin(), (x).end());
  for (__typeof((x).end()) it((x).begin()); it != ((x).end()); ++it) {
    char ch(*it);
    res *= p, res += ch;
  }
  return res;
}
long long ch[2015];
long long pp[2015];
long long ok[2015 * 2015];
int main() {
  pp[0] = 1;
  for (int i(1); i <= (2005); i++) pp[i] = pp[i - 1] * p;
  ch[0] = 0;
  string s;
  cin >> s;
  int n(((int)(s).size()));
  for (int i(0); i < (n); i++) ch[i + 1] = ch[i] + s[i] * pp[i];
  string pref, suff;
  cin >> pref >> suff;
  long long hpref(hash_simp(pref));
  int le_pref(((int)(pref).size()));
  long long hsuff(hash_simp(suff));
  int le_suff(((int)(suff).size()));
  int nok(0);
  for (int l(0); l < (n); l++)
    for (int le(max(le_pref, le_suff)); l + le <= (n); le++) {
      if (hpref * pp[l] == ch[l + le_pref] - ch[l])
        if (hsuff * pp[l + le - le_suff] == ch[l + le] - ch[l + le - le_suff]) {
          ok[nok++] = (ch[l + le] - ch[l]) * pp[n - l];
        }
    }
  sort(ok, ok + nok);
  cout << (unique(ok, ok + nok) - ok) << endl;
}
