#include <bits/stdc++.h>
using namespace std;
string s, be, en;
vector<long long> str;
const int p = 1007;
long long h[2005];
long long pw[2005];
long long shash(int l, int r) { return h[r] - h[l] * pw[r - l]; }
long long gethash(string t) {
  long long hash = 0;
  for (int i = 0; i < t.size(); i++) hash = hash * p + t[i];
  return hash;
}
int main() {
  cin >> s >> be >> en;
  pw[0] = 1;
  for (int i = 1; i <= s.size(); i++) pw[i] = pw[i - 1] * p;
  h[0] = 0;
  for (int i = 1; i <= s.size(); i++) {
    h[i] = p * h[i - 1] + s[i - 1];
  }
  long long b = gethash(be), e = gethash(en);
  int bs = be.size(), es = en.size();
  for (int i = 0; i + bs <= s.size(); i++) {
    if (shash(i, i + bs) == b) {
      for (int j = i; j + es <= s.size(); j++) {
        if (shash(j, j + es) == e && j + es >= i + bs)
          str.push_back(shash(i, j + es));
      }
    }
  }
  sort(str.begin(), str.end());
  str.erase(unique(str.begin(), str.end()), str.end());
  cout << str.size() << endl;
  return 0;
}
