#include <bits/stdc++.h>
using namespace std;
int fin[2222], ans, cnt;
string s, s1, s2, s3, s4;
class node {
 public:
  int dep;
  map<int, int> nex;
};
vector<node> v;
int fun(int nod, char ch, int pos) {
  node nd;
  nd.dep = v[nod].dep + 1;
  v[nod].nex[ch - 'a'] = ++cnt;
  v.push_back(nd);
  if (nd.dep >= (int)s1.size() && nd.dep >= (int)s2.size() && fin[pos]) {
    ans++;
  }
  return cnt;
}
int main() {
  cin >> s >> s1 >> s2;
  vector<int> v1, v2;
  for (int i = 0; i < (int)s.size(); i++) {
    if ((int)s.size() - i >= (int)s1.size()) {
      s3 = s.substr(i, (int)s1.size());
      if (s3 == s1) {
        v1.push_back(i);
      }
    }
    if ((int)s.size() - i >= (int)s2.size()) {
      s3 = s.substr(i, (int)s2.size());
      if (s3 == s2) {
        fin[i + (int)s2.size() - 1] = 1;
      }
    }
  }
  node nd;
  nd.dep = 0;
  v.push_back(nd);
  cnt = 0;
  int last;
  for (int i = 0; i < (int)v1.size(); i++) {
    last = 0;
    for (int j(v1[i]), _b((int)s.size()); j < _b; ++j) {
      if (v[last].nex.count(s[j] - 'a')) {
        last = v[last].nex[s[j] - 'a'];
      } else {
        last = fun(last, s[j], j);
      }
    }
  }
  cout << ans << endl;
}
