#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
template <typename T>
void print(T AA[], long long int nn) {
  for (long long int ii = 0; ii < nn; ii += 1) {
    cout << AA[ii] << " ";
  }
  cout << "\n";
}
template <typename T>
inline void print(T nn) {
  cout << nn << "\n";
}
const long long int N = 2e3 + 5;
string s, a, b;
long long int lps[N];
vector<long long int> v;
long long int start[N], finish[N];
map<string, long long int> d;
long long int a_n, b_n;
struct TrieNode {
  map<char, TrieNode *> children;
  long long int prefix_count = 0;
} * head;
void init() {
  head = new TrieNode();
  ;
  head->prefix_count = 0;
}
long long int ans = 0;
void insert(string &word, long long int idx) {
  long long int start_idx = idx;
  TrieNode *current = head;
  for (long long int i = 0; i < word.size(); i += 1) {
    char letter = word[i];
    if (current->children.find(letter) == current->children.end())
      current->children[letter] = new TrieNode();
    current = current->children[letter];
    if (finish[idx] == 1 && current->prefix_count == 0 &&
        (idx - start_idx) >= (a_n - b_n)) {
      current->prefix_count = 1;
      ans += 1;
    }
    idx += 1;
  }
}
void KMP(string &str1, string &str2) {
  v.clear();
  long long int n = str1.size();
  long long int m = str2.size();
  long long int i = 0, j = 0;
  while (i < n) {
    if (str2[j] == str1[i]) {
      i += 1;
      j += 1;
    }
    if (j == m) {
      v.push_back(i - j);
      j = lps[j - 1];
    } else if (i < n && str2[j] != str1[i]) {
      if (j != 0)
        j = lps[j - 1];
      else
        i += 1;
    }
  }
}
void LPS(string &pat) {
  long long int j = 0, i = 1;
  long long int M = pat.size();
  while (i < M) {
    if (pat[i] == pat[j]) {
      lps[i] = j + 1;
      i += 1;
      j += 1;
    } else {
      if (j == 0) {
        lps[i] = 0;
        i += 1;
      } else
        j = lps[j - 1];
    }
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (long long int i = 0; i < N; i += 1) {
    lps[i] = start[i] = finish[i] = 0;
  }
  cin >> s >> a >> b;
  a_n = a.size();
  b_n = b.size();
  LPS(a);
  KMP(s, a);
  for (long long int i = 0; i < v.size(); i += 1) start[v[i]] = 1;
  v.clear();
  LPS(b);
  KMP(s, b);
  for (long long int i = 0; i < v.size(); i += 1) finish[v[i]] = 1;
  init();
  for (long long int i = 0; i < s.size(); i += 1) {
    if (start[i] == 1) {
      string temp = s.substr(i);
      insert(temp, i);
    }
  }
  print(ans);
  return 0;
}
