#include <bits/stdc++.h>
using namespace std;
int pos_st[4000005], pos_en[4000005];
int node_cnt = 1;
unordered_map<int, int> trie[4000005];
int terminate_node[4000005];
int ans = 0;
void add(string second, int shift, int dd, int ss) {
  int n = second.size();
  int cur = 1;
  for (int i = 0; i < n; i++) {
    int ch = second[i] - '0';
    if (!trie[cur][ch]) {
      trie[cur][ch] = ++node_cnt;
    }
    cur = trie[cur][ch];
    if (pos_en[i + shift] == 1 && i >= dd - 1 && i >= ss - 1)
      terminate_node[cur] = 1;
  }
}
void Search() {
  for (int i = 0; i <= 4000000; i++) {
    if (terminate_node[i]) ans++;
  }
}
int main() {
  char t[2005], second[2005], d[2005];
  scanf("%s %s %s", t, second, d);
  int tt = strlen(t), ss = strlen(second), dd = strlen(d);
  for (int i = tt - 1; i >= 0; i--) {
    int yes = 0;
    for (int j = i, q = dd - 1; j >= 0; j--, q--) {
      if (d[q] != t[j]) break;
      if (q == 0) {
        yes = 1;
        break;
      }
    }
    if (yes) pos_en[i] = 1;
  }
  for (int i = 0; i < tt; i++) {
    int yes = 0;
    for (int j = i, p = 0; j < tt; j++, p++) {
      if (second[p] != t[j]) break;
      if (p == ss - 1) {
        yes = 1;
        break;
      }
    }
    if (yes) pos_st[i] = 1;
  }
  for (int i = 0; i < tt; i++) {
    if (pos_st[i] == 0) continue;
    string tmp;
    for (int j = i; j < tt; j++) {
      tmp += t[j];
    }
    add(tmp, i, dd, ss);
  }
  Search();
  printf("%d\n", ans);
}
