#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
const int maxn = 2000;
char s[maxn + 5], s1[maxn + 5], s2[maxn + 5];
const int seed = 1e9 + 7;
unsigned long long p1[maxn + 5], p2[maxn + 5];
void init() {
  p1[0] = 1;
  for (int i = 1; i < maxn; i++) {
    p1[i] = p1[i - 1] * seed;
  }
}
unsigned long long h1[maxn + 5], h2[maxn + 5];
unsigned long long gethash1(int l, int len) {
  return (h1[l] - (h1[len + l] * p1[len]));
}
int main() {
  init();
  scanf("%s", &s);
  int len = strlen(s);
  memset(h1, 0, sizeof(h1));
  for (int i = len - 1; i >= 0; i--) {
    h1[i] = (h1[i + 1] * seed + s[i]);
  }
  unsigned long long a = 0, b = 0;
  scanf("%s", &s1);
  scanf("%s", &s2);
  int len1 = strlen(s1), len2 = strlen(s2);
  for (int i = len1 - 1; i >= 0; i--) {
    a = (a * seed + s1[i]);
  }
  for (int i = len2 - 1; i >= 0; i--) {
    b = (b * seed + s2[i]);
  }
  vector<unsigned long long> ans;
  for (int i = 0; i + len1 <= len; i++) {
    unsigned long long t;
    t = gethash1(i, len1);
    if (t == a) {
      for (int j = i; j + len2 <= len; j++) {
        unsigned long long w;
        w = gethash1(j, len2);
        if (w == b) {
          if (j + len2 < i + len1) continue;
          unsigned long long q;
          q = gethash1(i, j - i + len2);
          ans.push_back(q);
        }
      }
    }
  }
  sort(ans.begin(), ans.end());
  unsigned long long res = 0;
  if (ans.size() > 0) res = 1;
  for (int i = 1; i < ans.size(); ++i)
    if (ans[i] != ans[i - 1]) ++res;
  printf("%I64d", res);
  return 0;
}
