#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int N = 2e3 + 5, M = 1e3 + 5, limit = 1e3 + 5;
vector<int> res[2];
void KMP(const string &second, const string &k, bool fen) {
  if (k.empty()) return;
  vector<int> tmp(k.size(), 0);
  for (int i = 1, j = 0; i < k.size(); ++i) {
    while (j && k[j] != k[i]) j = tmp[j - 1];
    if (k[j] == k[i]) ++j;
    tmp[i] = j;
  }
  for (int i = 0, j = 0; i < second.size(); ++i) {
    while (j && k[j] != second[i]) j = tmp[j - 1];
    if (k[j] == second[i]) ++j;
    if (j == k.size()) res[fen].push_back(i - j + 1);
  }
}
const int base = 31;
const int mod[3] = {(int)(1e9 + 7), (int)(1e9 - 63)};
int p[N][3] = {{1, 1, 1}}, inv[N][3] = {{1, 1, 1}};
int pwr(int b, int md) {
  int p = md - 2;
  int res = 1;
  while (p) {
    if (p & 1) res = (1ll * res * b) % md;
    b = (1ll * b * b) % md;
    p >>= 1;
  }
  return res;
}
void init() {
  for (int i = 1; i < N; ++i)
    for (int j = 0; j < 2; ++j) {
      p[i][j] = (1ll * p[i - 1][j] * base) % mod[j];
      inv[i][j] = pwr(p[i][j], mod[j]);
    }
}
struct rabinKarp {
  int val[2];
  deque<int> dq;
  rabinKarp() { memset(val, 0, sizeof val); }
  int size() { return dq.size(); }
  void push_back(int x) {
    for (int i = 0; i < 2; ++i) {
      val[i] = (1ll * val[i] * base) % mod[i];
      val[i] = (val[i] + x) % mod[i];
    }
    dq.push_back(x);
  }
  void push_front(int x) {
    for (int i = 0; i < 2; ++i) {
      int v = (1ll * x * p[dq.size()][i]) % mod[i];
      val[i] = (val[i] + v) % mod[i];
    }
    dq.push_front(x);
  }
  void pop_front() {
    int x = dq.front();
    for (int i = 0; i < 2; ++i) {
      int dumy = 1ll * dq.front() * p[dq.size() - 1][i] % mod[i];
      val[i] = ((val[i] - dumy) % mod[i] + mod[i]) % mod[i];
    }
    dq.pop_front();
  }
  void pop_back() {
    int v = dq.back();
    for (int i = 0; i < 2; ++i) {
      val[i] = ((val[i] - v) % mod[i] + mod[i]) % mod[i];
      val[i] = (1ll * val[i] * inv[1][i]) % mod[i];
    }
    dq.pop_back();
  }
  bool operator==(const rabinKarp &rhs) {
    if (rhs.dq.size() != dq.size()) return 0;
    for (int i = 0; i < 2; ++i)
      if (val[i] != rhs.val[i]) return 0;
    return 1;
  }
  pair<int, int> hashVal() { return {val[0], val[1]}; }
};
int k;
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(pair<uint64_t, uint64_t> x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x.first + FIXED_RANDOM) ^
           (splitmix64(x.second + FIXED_RANDOM) >> 1);
  }
};
int ans;
pair<int, int> arr[N][N];
unordered_map<pair<int, int>, bool, custom_hash> mp;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  init();
  rabinKarp x;
  string a, b, c;
  cin >> a >> b >> c;
  int N = a.size();
  for (int i = 0; i < N; ++i) {
    rabinKarp x;
    for (int j = i; j < N; ++j) {
      x.push_back(a[j] - 'a' + 1);
      arr[i][j] = x.hashVal();
    }
  }
  KMP(a, b, 0);
  KMP(a, c, 1);
  int n = b.size();
  int m = c.size();
  sort(res[0].begin(), res[0].end());
  sort(res[1].begin(), res[1].end());
  for (int i = 0; i < res[0].size(); ++i) {
    for (int j = 0; j < res[1].size(); ++j) {
      if (res[1][j] < max(res[0][i], res[0][i] + (n - m))) continue;
      mp[(arr[res[0][i]][res[1][j] + m - 1])] = 1;
    }
  }
  return cout << mp.size() << "\n", 0;
}
