#include <bits/stdc++.h>
using namespace std;
template <typename T>
void print(T x) {
  cout << x << endl;
}
template <typename T1, typename T2>
void print2(T1 x, T2 y) {
  cout << x << " " << y << endl;
}
template <typename T1, typename T2, typename T3>
void print3(T1 x, T2 y, T3 z) {
  cout << x << " " << y << " " << z << endl;
}
bool isvowel(char v) { return (0x208222 >> (v & 0x1f)) & 1; }
long int mceil(long int a, long int b) {
  if (a % b == 0)
    return (a / b);
  else
    return (a / b + 1);
}
long int mfloor(long int a, long int b) { return (a / b); }
long long modmul(long long a, long long b) {
  return ((a % 1000000007) * (b % 1000000007)) % 1000000007;
}
long long modadd(long long a, long long b) {
  return ((a % 1000000007) + (b % 1000000007) + 1000000007) % 1000000007;
}
long long modsub(long long a, long long b) {
  return ((a % 1000000007) - (b % 1000000007) + 1000000007) % 1000000007;
}
long int fastexpo(long int a, long int b) {
  a = a % 1000000007;
  long int ans = 1;
  while (b) {
    if (b & 1) ans = (ans * 1ll * a) % 1000000007;
    a = (a * 1ll * a) % 1000000007;
    b = b / 2;
  }
  return ans;
}
long int pow_p1[2064];
long int p_inv1[2064];
long int pow_p2[2064];
long int p_inv2[2064];
void init(long int p1, long int p2) {
  pow_p1[0] = p_inv1[0] = pow_p2[0] = p_inv2[0] = 1;
  long int pinv1 = fastexpo(p1, 1000000007 - 2);
  long int pinv2 = fastexpo(p2, 1000000007 - 2);
  for (long int i = 1; i < 2064; i++) {
    pow_p1[i] = modmul(pow_p1[i - 1], p1);
    p_inv1[i] = modmul(p_inv1[i - 1], pinv1);
    pow_p2[i] = modmul(pow_p2[i - 1], p2);
    p_inv2[i] = modmul(p_inv2[i - 1], pinv2);
  }
}
struct Hash {
  vector<long int> prehash1, prehash2;
  void precomputehash(string& s) {
    long int n = int(s.size());
    prehash1.resize(n), prehash2.resize(n);
    prehash2[0] = prehash1[0] = (s[0] - 'a') + 1;
    for (long int i = 1; i < s.size(); i++) {
      prehash1[i] =
          modadd(prehash1[i - 1], modmul((s[i] - 'a' + 1), pow_p1[i]));
      prehash2[i] =
          modadd(prehash2[i - 1], modmul((s[i] - 'a' + 1), pow_p2[i]));
    }
  }
  pair<long int, long int> gethash(long int l, long int r) {
    if (l == 0)
      return (
          make_pair((prehash1[r] % 1000000007), (prehash2[r] % 1000000007)));
    else {
      long int ans1 = modsub(prehash1[r], prehash1[l - 1]);
      ans1 = modmul(ans1, p_inv1[l]);
      long int ans2 = modsub(prehash2[r], prehash2[l - 1]);
      ans2 = modmul(ans2, p_inv2[l]);
      return (make_pair(ans1, ans2));
    }
  }
  pair<long int, long int> totalhash(string& s) {
    return (make_pair(prehash1[int(s.size()) - 1] % 1000000007,
                      prehash2[int(s.size()) - 1] % 1000000007));
  }
};
pair<long int, long int> getHash(vector<long int>& prehash1,
                                 vector<long int>& prehash2, long int l,
                                 long int r) {
  if (l == 0)
    return (make_pair((prehash1[r] % 1000000007), (prehash2[r] % 1000000007)));
  else {
    long int ans1 = modsub(prehash1[r], prehash1[l - 1]);
    ans1 = modmul(ans1, p_inv1[l]);
    long int ans2 = modsub(prehash2[r], prehash2[l - 1]);
    ans2 = modmul(ans2, p_inv2[l]);
    return (make_pair(ans1, ans2));
  }
}
pair<long int, long int> valid(vector<long int>& prehash1,
                               vector<long int>& prehash2, string& st,
                               string& en,
                               pair<long int, long int> total_hash_st,
                               pair<long int, long int> total_hash_en) {
  if ((getHash(prehash1, prehash2, 0, int(st.size()) - 1) == total_hash_st) and
      (getHash(prehash1, prehash2, int(prehash1.size()) - int(en.size()),
               int(prehash1.size()) - 1) == total_hash_en))
    return (getHash(prehash1, prehash2, 0, int(prehash1.size()) - 1));
  return {0l, 0l};
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long int t = 1;
  init(53, 107);
  while (t--) {
    string s, st, en;
    cin >> s >> st >> en;
    long int req = max(int(st.size()), int(en.size()));
    long int lst = int(st.size());
    long int est = int(en.size());
    Hash obja, objb;
    obja.precomputehash(st);
    objb.precomputehash(en);
    pair<long int, long int> total_hash_st = obja.totalhash(st);
    pair<long int, long int> total_hash_en = objb.totalhash(en);
    vector<pair<long int, long int> > stt;
    for (long int i = 0; i < int(s.size()); i++) {
      vector<long int> prehash1;
      vector<long int> prehash2;
      prehash1.emplace_back((s[i] - 'a') + 1);
      prehash2.emplace_back((s[i] - 'a') + 1);
      if (int(prehash1.size()) >= (req)) {
        pair<long int, long int> value =
            valid(prehash1, prehash2, st, en, total_hash_st, total_hash_en);
        if (value != make_pair(0l, 0l)) {
          stt.emplace_back(value);
        }
      }
      long int x = 1;
      for (long int j = i + 1; j < int(s.size()); j++) {
        prehash1.emplace_back(
            modadd(prehash1.back(), modmul(s[j] - 'a' + 1, pow_p1[x])));
        prehash2.emplace_back(
            modadd(prehash2.back(), modmul(s[j] - 'a' + 1, pow_p2[x])));
        x++;
        if (int(prehash1.size()) >= (req)) {
          pair<long int, long int> value =
              valid(prehash1, prehash2, st, en, total_hash_st, total_hash_en);
          if (value != make_pair(0l, 0l)) {
            stt.emplace_back(value);
          }
        }
      }
    }
    sort(stt.begin(), stt.end());
    stt.resize(unique(stt.begin(), stt.end()) - stt.begin());
    print(int(stt.size()));
  }
  return 0;
}
