#include <bits/stdc++.h>
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
inline int read() {
  int ans = 0;
  bool f = 1;
  char ch = getchar();
  while (!isdigit(ch)) f ^= ch == '-', ch = getchar();
  while (isdigit(ch)) ans = ((ans << 2) + ans << 1) + (ch ^ 48), ch = getchar();
  return f ? ans : -ans;
}
string s, sbegin, send;
int a[5010], b[5010];
unordered_set<long long> us;
int main(int argc, char const *argv[]) {
  ios::sync_with_stdio(false);
  cin >> s >> sbegin >> send;
  for (int i = 0; i < s.size(); i++)
    a[i] = (s.substr(i, sbegin.size()) == sbegin),
    b[i + send.size() - 1] = (s.substr(i, send.size()) == send);
  long long ret = 0ll;
  for (int i = 0; i < s.size(); i++)
    if (a[i]) {
      ret = 0ll;
      for (int j = i; j < s.size(); j++) {
        ret = ret * 3517 % 1000000007 + s[j];
        if (b[j] && j - i + 1 >= max(sbegin.size(), send.size()))
          us.insert(ret);
      }
    }
  cout << us.size();
  return 0;
}
