#include <bits/stdc++.h>
using namespace std;
vector<unsigned long long> vec;
const int maxn = 5005;
int x[maxn];
int y[maxn];
int main() {
  string s, s1, s2;
  cin >> s >> s1 >> s2;
  int le = s1.size(), ri = s2.size();
  int len = s.size();
  for (int i = 0; i < len; i++) {
    if (s.substr(i, le) == s1) x[i] = 1;
    if (s.substr(i, ri) == s2) y[i + ri - 1] = 1;
  }
  int num = 0;
  for (int i = 0; i < len; i++) {
    unsigned long long cnt = 0;
    if (x[i]) {
      for (int j = i; j < len; j++) {
        cnt = 27 * cnt + s[j] - 'a' + 1;
        if (y[j] && j - i + 1 >= max(ri, le)) {
          vec.push_back(cnt);
        }
      }
    }
  }
  sort(vec.begin(), vec.end());
  int tim = 0;
  int siz = vec.size();
  for (int i = 0; i < siz; i++) {
    if (i == 0)
      ++tim;
    else if (vec[i] != vec[i - 1])
      ++tim;
  }
  cout << tim << endl;
}
