#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, n, k, j, len1, len2, len3;
  unordered_set<long long> a;
  long long h;
  long long b[2280];
  long long b1[2280];
  string t;
  string beg, en, f;
  cin >> t >> beg >> en;
  n = t.length();
  len1 = beg.length();
  len2 = en.length();
  for (i = 0; i < n - len1 + 1; i++) {
    f = t.substr(i, len1);
    if (f == beg) b[i] = 1;
  }
  for (i = 0; i < n - len2 + 1; i++) {
    f = t.substr(i, len2);
    if (f == en) b1[i] = 1;
  }
  for (i = 0; i < n; i++) {
    h = 0;
    if (b[i] == 1)
      for (j = i; j < n; j++) {
        h = h * 10000019 + t[j];
        if (b1[j] == 1 and i + len1 <= j + len2) {
          a.insert(h);
        }
      }
  }
  cout << a.size();
  return 0;
}
