#include <bits/stdc++.h>
using namespace std;
typedef struct trie {
  trie *children[26];
  trie() {
    for (int i = int(0); i < int(26); i++) {
      children[i] = nullptr;
    }
  }
  void add_word(char *word) {
    if (*word == '\0') {
      return;
    }
    int mask = *word - 'a';
    if (children[mask] == nullptr) {
      children[mask] = new trie();
    }
    return children[mask]->add_word(word + 1);
  }
  trie *find_ptr(char *word) {
    if (*word == '\0') {
      return this;
    }
    int mask = *word - 'a';
    if (children[mask] == nullptr) {
      return nullptr;
    }
    return children[mask]->find_ptr(word + 1);
  }
  int count(char *word, int focused) {
    if (*word == '\0') {
      return 1;
    }
    int mask = *word - 'a';
    int total = 0;
    if (focused) {
      if (children[mask] != nullptr) {
        total = children[mask]->count(word + 1, 1);
      }
    } else {
      for (int i = int(0); i < int(26); i++) {
        if (children[i] != nullptr) {
          total += children[i]->count(word, 0);
          total += children[i]->count(word, 1);
        }
      }
    }
    return total;
  }
} trie;
const int MAX = 2e3 + 5;
char T[MAX], ss[MAX], se[MAX], fin[2 * MAX];
int main() {
  scanf("%s", T);
  scanf("%s", ss);
  scanf("%s", se);
  int N = strlen(T);
  int sa = strlen(ss);
  int sb = strlen(se);
  int pref = 0;
  vector<int> prefs;
  for (int i = int(max(0, sa - sb)); i < int(sa); i++) {
    bool bom = true;
    int lim = min(sb, sa - i);
    for (int j = int(0); j < int(lim); j++) {
      if (se[j] != ss[i + j]) {
        bom = false;
        break;
      }
    }
    if (bom) {
      pref = sa - i;
      prefs.push_back(pref);
    }
  }
  trie root;
  for (int i = int(0); i < int(N); i++) {
    root.add_word(T + i);
  }
  memcpy(fin, ss, sizeof(char) * sa);
  int to_add = 0;
  for (auto &i : prefs) {
    memcpy(fin + sa, se + i, sizeof(char) * (sb - i));
    int fin_sz = sa + sb - pref;
    fin[fin_sz] = '\0';
    to_add += root.count(fin, 1);
  }
  trie *node = root.find_ptr(ss);
  if (node == nullptr) {
    printf("%d\n", to_add);
  } else {
    printf("%d\n", node->count(se, 0) + node->count(se, 1) + to_add);
  }
  return 0;
}
