#include <bits/stdc++.h>
using namespace std;
bool can1[5000];
bool can2[5000];
char data[5000];
char tmp[5000];
char a[5000];
char b[5000];
set<long long> dict;
const long long MOD = 188748146801ll;
const int tablesize = 10000007;
long long table[tablesize];
void insert(long long n) {
  int seed = n % tablesize;
  while (table[seed] != 0 && table[seed] != n) {
    seed++;
    if (seed >= tablesize) seed = 0;
  }
  table[seed] = n;
}
bitset<10000000> gao;
int main() {
  while (gets(data)) {
    memset(can1, 0, sizeof(can1));
    memset(can2, 0, sizeof(can2));
    dict.clear();
    gets(a);
    gets(b);
    int la = strlen(a);
    int lb = strlen(b);
    int ld = strlen(data);
    for (char *i = data; i = strstr(i, a); i = i + 1) {
      can1[i - data] = true;
    }
    if (0)
      for (int i = 0; i < strlen(data); i++) printf("%d ", can1[i]);
    char big = 0;
    for (int i = 0; i < ld; i++) {
      if (data[i] > big) big = data[i];
    }
    for (int i = lb - 1; i < ld; i++) {
      bool can = true;
      for (int j = 0; j < lb; j++) {
        if (b[j] != data[i - lb + j + 1]) {
          can = false;
          break;
        }
      }
      can2[i] = can;
    }
    if (0)
      for (int i = 0; i < strlen(data); i++) printf("%d ", can2[i]);
    for (int i = 0; i < ld; i++) {
      if (!can1[i]) continue;
      long long now = 1;
      for (int j = i; j < ld; j++) {
        now = (now * (long long)(big - 'a' + 1) +
               (long long)((data[j] - 'a' + 1))) %
              MOD;
        if (j - i + 1 >= la && j - i + 1 >= lb)
          if (can2[j]) {
            if (now >= 10000000) {
              insert(now);
            } else {
              gao.set(now);
            }
          }
      }
    }
    int res = gao.count();
    for (int i = 0; i < tablesize; i++) {
      res += !!table[i];
    }
    printf("%d\n", res);
  }
}
