#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
inline long long read() {
  long long X = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  return w ? -X : X;
}
long long hashnum[3000];
long long hah[3000];
vector<long long> res;
long long gethash(long long l, long long r) {
  return (hah[r] - (l ? hah[l - 1] : 0)) * hashnum[2099 - r];
}
long long tohash(string s) {
  long long ans = 0;
  for (long long i = 0; i < s.size(); i++) {
    ans += (s[i] - 'a' + 1) * hashnum[i];
  }
  return ans * hashnum[2100 - s.size()];
}
int main() {
  hashnum[0] = 1;
  for (long long i = 1; i < 2500; i++) {
    hashnum[i] = 19260817 * hashnum[i - 1];
  }
  string s, a, b;
  cin >> s;
  cin >> a >> b;
  long long h1 = tohash(a);
  long long h2 = tohash(b);
  hah[0] = s[0] - 'a' + 1;
  for (long long i = 1; i < s.size(); i++) {
    hah[i] = hah[i - 1] + (s[i] - 'a' + 1) * hashnum[i];
  }
  long long l1 = a.size();
  long long l2 = b.size();
  for (long long i = 0; i <= (long long)s.size() - l1; i++) {
    for (long long j = i + max(l1, l2) - 1; j < (long long)s.size(); j++) {
      if (gethash(i, i + l1 - 1) == h1 and gethash(j - l2 + 1, j) == h2) {
        res.push_back(gethash(i, j));
      }
    }
  }
  sort(res.begin(), res.end());
  res.erase(unique(res.begin(), res.end()), res.end());
  cout << res.size();
  return 0;
}
