#include <bits/stdc++.h>
using namespace std;
vector<int> pre;
int suf[2020], K = 0;
struct NODE {
  int flag;
  NODE *x[26];
  NODE() {
    flag = 1;
    fill(x, x + 26, (NODE *)0);
  };
};
NODE *find(NODE *r, char c) {
  if (!r->x[c - 'a'])
    return r->x[c - 'a'] = new NODE;
  else
    return r->x[c - 'a'];
}
int main() {
  string s, x, y;
  cin >> s >> x >> y;
  for (int i = 0; i < (int)(s.size() - x.size() + 1); i++) {
    bool f = true;
    for (int j = 0; j < (int)(x.size()); j++) f &= s[i + j] == x[j];
    if (f) pre.push_back(i);
  }
  for (int i = 0; i < (int)(s.size() - y.size() + 1); i++) {
    bool f = true;
    for (int j = 0; j < (int)(y.size()); j++) f &= s[i + j] == y[j];
    if (f) suf[i + y.size() - 1] = 1;
  }
  NODE *r = new NODE;
  int ans = 0;
  for (int i = 0; i < (int)(pre.size()); i++) {
    NODE *head = r;
    for (int j = pre[i]; j < s.size(); j++) {
      head = find(head, s[j]);
      if (j >= pre[i] + x.size() - 1 && (int)j - y.size() + 1 >= pre[i] &&
          suf[j] && head->flag) {
        ans++;
        head->flag = 0;
      }
    }
  }
  cout << ans << endl;
}
