#include <bits/stdc++.h>
using namespace std;
const int P = 1000007;
unsigned long long pw[2005], val[2005], va[2005], vb[2005], a, b;
char s1[2005], s2[2005], st[2005];
vector<unsigned long long> que[100005];
unsigned long long Hash(int a, int b) {
  return val[b] - val[a - 1] * pw[b - a + 1];
}
bool judge(unsigned long long h) {
  int base = h % 100005;
  for (int i = 0; i < que[base].size(); i++)
    if (que[base][i] == h) return 0;
  que[base].push_back(h);
  return 1;
}
void solve() {
  int i, j, len1, len2, len, ans;
  unsigned long long k;
  len = strlen(st + 1);
  len1 = strlen(s1 + 1);
  len2 = strlen(s2 + 1);
  val[0] = 0;
  pw[0] = 1;
  for (i = 1; i <= len; i++) pw[i] = pw[i - 1] * P;
  for (i = 1; i <= len; i++) val[i] = val[i - 1] * P + st[i];
  va[0] = 0;
  vb[0] = 0;
  for (i = 1; i <= len1; i++) va[i] = va[i - 1] * P + s1[i];
  for (i = 1; i <= len2; i++) vb[i] = vb[i - 1] * P + s2[i];
  a = va[len1];
  b = vb[len2];
  ans = 0;
  for (i = 1; i <= len; i++)
    for (j = i; j <= len; j++) {
      k = j - i + 1;
      if (k >= len1 && k >= len2) {
        if (Hash(i, i + len1 - 1) == a && Hash(j - len2 + 1, j) == b) {
          k = Hash(i, j);
          if (judge(k)) ans++;
        }
      }
    }
  cout << ans << endl;
}
int main() {
  cin >> st + 1 >> s1 + 1 >> s2 + 1;
  solve();
  return 0;
}
