#include <bits/stdc++.h>
using namespace std;
const pair<long long, long long> M = make_pair(1e9 + 7, 1e9 + 9);
const long long base = 347;
const int N = 1e6 + 7;
ostream& operator<<(ostream& os, pair<long long, long long> hash) {
  return os << "(" << hash.first << ", " << hash.second << ")";
}
pair<long long, long long> operator+(const pair<long long, long long>& a,
                                     long long x) {
  return make_pair(a.first + x, a.second + x);
}
pair<long long, long long> operator-(const pair<long long, long long>& a,
                                     long long x) {
  return make_pair(a.first - x, a.second - x);
}
pair<long long, long long> operator*(const pair<long long, long long>& a,
                                     long long x) {
  return make_pair(a.first * x, a.second * x);
}
pair<long long, long long> operator+(const pair<long long, long long>& a,
                                     pair<long long, long long> x) {
  return make_pair(a.first + x.first, a.second + x.second);
}
pair<long long, long long> operator-(const pair<long long, long long>& a,
                                     pair<long long, long long> x) {
  return make_pair(a.first - x.first, a.second - x.second);
}
pair<long long, long long> operator*(const pair<long long, long long>& a,
                                     pair<long long, long long> x) {
  return make_pair(a.first * x.first, a.second * x.second);
}
pair<long long, long long> operator%(const pair<long long, long long>& a,
                                     pair<long long, long long> m) {
  return make_pair(a.first % m.first, a.second % m.second);
}
pair<long long, long long> reduce(const pair<long long, long long>& a) {
  pair<long long, long long> ans;
  ans.first =
      (a.first >= M.first ? a.first - M.first
                          : (a.first < 0 ? a.first + M.first : a.first));
  ans.second =
      (a.second >= M.second ? a.second - M.second
                            : (a.second < 0 ? a.second + M.second : a.second));
  return ans;
}
pair<long long, long long> power(const pair<long long, long long>& a,
                                 long long p) {
  if (p == 0) return make_pair(1, 1);
  pair<long long, long long> ans = power(a, p / 2);
  ans = (ans * ans) % M;
  if (p % 2) ans = (ans * a) % M;
  return ans;
}
pair<long long, long long> inverse(pair<long long, long long> a) {
  return power(a, (M.first - 1) * (M.second - 1) - 1);
}
pair<long long, long long> pb[N];
pair<long long, long long> invb;
void hashPre() {
  pb[0] = make_pair(1, 1);
  for (int i = 1; i < N; i++) pb[i] = (pb[i - 1] * base) % M;
  invb = inverse(pb[1]);
}
vector<pair<long long, long long> > hashList(string s) {
  int n = s.size();
  vector<pair<long long, long long> > ans(n + 1);
  ans[0] = make_pair(0, 0);
  for (int i = 1; i <= n; i++) ans[i] = (ans[i - 1] * base + s[i - 1]) % M;
  return ans;
}
pair<long long, long long> substringHash(
    const vector<pair<long long, long long> >& hashlist, int l, int r) {
  int len = (r - l + 1);
  return reduce((hashlist[r] - hashlist[l - 1] * pb[len]) % M);
}
pair<long long, long long> Hash(string s) {
  pair<long long, long long> ans = make_pair(0, 0);
  for (int i = 0; i < s.size(); i++) ans = (ans * base + s[i]) % M;
  return ans;
}
pair<long long, long long> append(pair<long long, long long> cur, char c) {
  return (cur * base + c) % M;
}
pair<long long, long long> prepend(pair<long long, long long> cur, int k,
                                   char c) {
  return (pb[k] * c + cur) % M;
}
pair<long long, long long> replace(pair<long long, long long> cur, int i,
                                   char a, char b) {
  cur = (cur + pb[i] * (b - a)) % M;
  return reduce(cur);
}
pair<long long, long long> pop_back(pair<long long, long long> hash, char c) {
  return reduce(((hash - c) * invb) % M);
}
pair<long long, long long> pop_front(pair<long long, long long> hash, int len,
                                     char c) {
  return reduce((hash - pb[len - 1] * c) % M);
}
pair<long long, long long> concat(pair<long long, long long> left,
                                  pair<long long, long long> right, int k) {
  return (left * pb[k] + right) % M;
}
pair<long long, long long> repeat(pair<long long, long long> hash, int len,
                                  long long cnt) {
  pair<long long, long long> mul =
      reduce(((pb[len * cnt] - 1) * inverse(pb[len] - 1)) % M);
  pair<long long, long long> ans = (hash * mul);
  if (pb[len].first == 1) ans.first = hash.first * cnt;
  if (pb[len].second == 1) ans.second = hash.second * cnt;
  return ans % M;
}
int main() {
  hashPre();
  string t;
  cin >> t;
  string sBegin, sEnd;
  cin >> sBegin >> sEnd;
  pair<long long, long long> hBegin = Hash(sBegin), hEnd = Hash(sEnd);
  vector<pair<long long, long long> > tHash = hashList(t);
  int minSize = max(sBegin.size(), sEnd.size());
  int n = t.size();
  vector<pair<long long, long long> > distinct;
  for (int i = 1; i <= n; i++) {
    for (int j = i + minSize - 1; j <= n; j++) {
      if (substringHash(tHash, i, i + (int)sBegin.size() - 1) == hBegin &&
          substringHash(tHash, j - (int)sEnd.size() + 1, j) == hEnd) {
        distinct.push_back(substringHash(tHash, i, j));
      }
    }
  }
  sort(distinct.begin(), distinct.end());
  distinct.erase(unique(distinct.begin(), distinct.end()), distinct.end());
  cout << distinct.size() << endl;
}
