#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:134217728")
using namespace std;
const int MOD = (int)1e9 + 7;
long long x1[1 << 11], x2[1 << 11];
long long h1[1 << 11], h2[1 << 11];
string a, b, c;
long long gethash(string& s) {
  long long h1 = 0, h2 = 0;
  for (int i = 0; i < s.size(); ++i) {
    h1 = (h1 * 2999 + s[i]) % MOD;
    h2 = (h2 * 3137 + s[i]) % MOD;
  }
  return h1 * MOD + h2;
}
long long gethash(int pos, int len) {
  long long a = (h1[pos + len] - h1[pos] * x1[len]) % MOD;
  long long b = (h2[pos + len] - h2[pos] * x2[len]) % MOD;
  if (a < 0) a += MOD;
  if (b < 0) b += MOD;
  return a * MOD + b;
}
int main() {
  cin >> c >> a >> b;
  x1[0] = x2[0] = 1;
  for (int i = 1; i < 1 << 11; ++i) {
    x1[i] = x1[i - 1] * 2999 % MOD;
    x2[i] = x2[i - 1] * 3137 % MOD;
  }
  for (int i = 0; i < c.size(); ++i) {
    h1[i + 1] = (h1[i] * 2999 + c[i]) % MOD;
    h2[i + 1] = (h2[i] * 3137 + c[i]) % MOD;
  }
  long long ha = gethash(a);
  long long hb = gethash(b);
  vector<long long> S;
  for (int i = 0; i <= (int)c.size() - (int)a.size(); ++i)
    for (int j = i; j <= (int)c.size() - (int)b.size(); ++j) {
      if (i + a.size() > j + b.size()) continue;
      if (gethash(i, a.size()) != ha || gethash(j, b.size()) != hb) continue;
      S.push_back(gethash(i, max(i + a.size(), j + b.size()) - i));
    }
  sort(S.begin(), S.end());
  S.resize(unique(S.begin(), S.end()) - S.begin());
  cout << S.size() << endl;
  return 0;
}
