#include <bits/stdc++.h>
using namespace std;
const int MAX = 2323;
const int HASH1 = 8960453;
const int HASH2 = 1000007;
vector<int> v1, v2;
char ip[MAX], t1[MAX], t2[MAX];
int lip, lt1, lt2;
bool ft[MAX], lt[MAX];
int ans;
set<long long> hs[HASH2];
bool meteor(char* ms, int le, int ps) {
  for (int i = 0; i < le; i++) {
    if (ms[i] != ip[i + ps]) {
      return 0;
    }
  }
  return 1;
}
int main() {
  gets(ip);
  gets(t1);
  gets(t2);
  lip = strlen(ip);
  lt1 = strlen(t1);
  lt2 = strlen(t2);
  for (int i = 0; i + lt1 <= lip; i++) {
    if (meteor(t1, lt1, i)) {
      ft[i] = 1;
    }
  }
  for (int i = 0; i + lt2 <= lip; i++) {
    if (meteor(t2, lt2, i)) {
      lt[i] = 1;
    }
  }
  for (int i = 0; i < lip; i++) {
    if (ft[i]) {
      long long nh = 0, rh = 0;
      for (int j = i; j < lip; j++) {
        nh *= 17239;
        nh += ip[j];
        rh = (nh % HASH2 + HASH2) % HASH2;
        if (lt[j] && (i + lt1 <= j + lt2)) {
          if (hs[rh].find(nh) == hs[rh].end()) {
            ans++;
            hs[rh].insert(nh);
          }
        }
      }
    }
  }
  printf("%d", ans);
}
