#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long cl(long double a) {
  if (a > (long long)a) {
    return (long long)a + 1;
  } else {
    return (long long)a;
  }
}
long long flr(long double a) {
  if (a < 0.0) {
    return (long long)a - 1;
  }
  return (long long)a;
}
const long long M = 2010;
long long p1[M] = {0}, p2[M] = {0};
string s, s1, s2;
long long ans = 0;
class Node {
 public:
  char data;
  unordered_map<char, Node*> children;
  long long cnt;
  Node(char d) {
    data = d;
    cnt = 0;
  }
};
class Trie {
  Node* root;

 public:
  Trie() { root = new Node('\0'); }
  void insert(long long idx) {
    Node* temp = root;
    for (long long i = idx; i < s.length(); i++) {
      char ch = s[i];
      if (temp->children.count(ch)) {
        temp = temp->children[ch];
      } else {
        Node* n = new Node(ch);
        temp->children[ch] = n;
        temp = n;
      }
      if (i - idx + 1 >= max(s1.length(), s2.length()) && temp->cnt == 0 &&
          p2[i]) {
        temp->cnt++;
        ans++;
      }
    }
  }
};
vector<long long> z_function(string& s) {
  long long n = (long long)s.size();
  vector<long long> z(n);
  for (long long 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 && s[z[i]] == s[i + z[i]]) ++z[i];
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
  return z;
}
void solve() {
  cin >> s;
  cin >> s1;
  cin >> s2;
  long long n = s.length();
  string ts1 = s1 + s;
  string ts2 = s2 + s;
  vector<long long> z1 = z_function(ts1);
  vector<long long> z2 = z_function(ts2);
  for (long long i = s1.length(); i < z1.size(); i++) {
    if (z1[i] >= s1.length()) p1[i - s1.length()]++;
  }
  for (long long i = s2.length(); i < z2.size(); i++) {
    if (z2[i] >= s2.length()) p2[i - 1]++;
  }
  Trie tr;
  for (long long i = 0; i < n; i++) {
    if (p1[i]) {
      tr.insert(i);
    }
  }
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  t = 1;
  while (t--) solve();
}
