#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << "\t";
  err(++it, args...);
}
const int MOD = 1000000007;
const int N = 2e5;
vector<int> z_function(string second) {
  int n = (int)second.length();
  vector<int> z(n);
  for (int i = 1, l = 0, r = 0; i < n; ++i) {
    if (i <= r) z[i] = min(r - i + 1, z[i - l]);
    while (i + z[i] < n && second[z[i]] == second[i + z[i]]) ++z[i];
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
  return z;
}
vector<int> fillSS(string second, string add, int t) {
  vector<int> z = z_function(add + second);
  int len = add.size(), n = second.size();
  vector<int> ss(n, 0);
  for (int i = (len); len < len + n ? i < len + n : i > len + n;
       len < len + n ? i++ : i--)
    if (z[i] >= len) {
      if (t == 1)
        ss[i - len]++;
      else
        ss[i - 1]++;
    }
  return ss;
}
struct trie {
  int start;
  int end;
  int used;
  struct trie* child[26];
};
trie* newNode() {
  trie* node = new trie;
  node->start = node->end = node->used = 0;
  for (int i = (0); 0 < 26 ? i < 26 : i > 26; 0 < 26 ? i++ : i--)
    node->child[i] = NULL;
  return node;
}
trie* root = NULL;
vector<int> ss1, ss2;
int a, b;
void addWord(string second, int lo, int hi) {
  trie* temp = root;
  for (int i = (lo); lo < hi + 1 ? i < hi + 1 : i > hi + 1;
       lo < hi + 1 ? i++ : i--) {
    if (temp->child[second[i] - 'a'] == NULL)
      temp->child[second[i] - 'a'] = newNode();
    temp = temp->child[second[i] - 'a'];
    temp->start |= ss1[i];
    temp->end |= ss2[i];
  }
}
void buildTrie(string second) {
  root = newNode();
  string temp = "";
  int n = second.size();
  for (int i = (0); 0 < n ? i < n : i > n; 0 < n ? i++ : i--)
    addWord(second, i, n - 1);
}
long long int count(string second) {
  trie* node = root;
  long long int cnt = 0;
  for (int i = (0); 0 < second.size() ? i < second.size() : i > second.size();
       0 < second.size() ? i++ : i--) {
    node = node->child[second[i] - 'a'];
    if (node->end && node->used == 0 && i >= a - 1 && i >= b - 1)
      cnt++, node->used = 1;
  }
  return cnt;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string second, s1, s2;
  cin >> second >> s1 >> s2;
  int n = second.size();
  a = s1.size(), b = s2.size();
  ss1 = fillSS(second, s1, 1);
  ss2 = fillSS(second, s2, 2);
  buildTrie(second);
  string temp = "";
  long long int ans = 0;
  for (int i = (n - 1); n - 1 < -1 ? i < -1 : i > -1; n - 1 < -1 ? i++ : i--) {
    temp = second[i] + temp;
    if (ss1[i]) ans += count(temp);
  }
  cout << ans;
  return 0;
}
