#include <bits/stdc++.h>
using namespace std;
long long i, j, k, l, n, x, m, val, k1, k2, k3, b[30000], c[30000],
    mod = 5237732522753;
string s, s1, s2;
long long dp[3000][3000];
unordered_map<long long, long long> mymap;
unordered_map<long long, long long>::iterator it;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> s >> s1 >> s2;
  if (s.size() < s1.size() || s.size() < s2.size()) {
    cout << 0;
    exit(0);
  }
  for (i = 0; i < s.size(); i++) {
    l = 1;
    m = 0;
    for (j = i; j < s.size(); j++) {
      m = ((m * 53 + s[j]) % mod + mod) % mod;
      dp[i][j] = m;
    }
  }
  for (i = 0; i <= s.size() - s1.size(); i++) {
    k = 0;
    for (j = 0; j < s1.size(); j++)
      if (s[i + j] != s1[j]) k = 1;
    if (k == 0) b[i] = 1;
  }
  for (i = 0; i <= s.size() - s2.size(); i++) {
    k = 0;
    for (j = 0; j < s2.size(); j++)
      if (s[i + j] != s2[j]) k = 1;
    if (k == 0) c[i] = 1;
  }
  for (i = 0; i < s.size(); i++) {
    if (b[i] == 1) {
      for (j = i; j < s.size(); j++)
        if (c[j] == 1 && j + s2.size() - i >= s1.size()) {
          mymap[dp[i][j + s2.size() - 1]] = 1;
        }
    }
  }
  l = 0;
  for (it = mymap.begin(); it != mymap.end(); it++) l++;
  cout << l;
}
