#include <bits/stdc++.h>
using namespace std;
const int mod = 999997;
template <class TK, class TV, int _mod = mod, int _n = 2000000>
class HashTable {
  struct H {
    TK key;
    TV val;
    int next;
  } h[_n];
  int list[_mod], eid;
  int (*hash)(TK);

 public:
  HashTable() { clear(); }
  void clear() {
    memset(list, -1, sizeof(list));
    eid = 0;
  }
  void setCallBack(int (*hash)(TK)) { this->hash = hash; }
  int find(TK key) {
    int ind = hash(key);
    for (int p = list[ind]; p != -1; p = h[p].next) {
      if (h[p].key == key) return p;
    }
    return -1;
  }
  void insert(TK key, TV val = 0) {
    int ind = hash(key);
    h[eid].key = key;
    h[eid].val = val;
    h[eid].next = list[ind];
    list[ind] = eid++;
  }
  TV &operator[](TK key) {
    int t = find(key);
    if (t == -1) {
      insert(key, TV());
      return h[eid - 1].val;
    } else
      return h[t].val;
  }
  void print(TK *out, int &N) {
    for (int i = 0; i < eid; i++) out[i] = h[i].key;
    N = eid;
  }
};
inline int h(unsigned long long V) { return V % mod; }
HashTable<unsigned long long, int> ht[2];
char buf[310000];
char s1[2222], s2[2222];
set<int> st1, st2;
int next[2222];
void kmp(char *s, set<int> &st) {
  st.clear();
  int len = strlen(buf + 1), len2 = strlen(s + 1);
  for (int i = 1; i <= len; i++) {
    bool same = true;
    for (int j = 1; j <= len2; j++) {
      if (buf[i + j - 1] != s[j]) same = false;
    }
    if (same) st.insert(i);
  }
}
unsigned long long sum[2][2222];
unsigned long long P[2] = {5453453257347437LL, 543276475487842632LL};
int main() {
  srand(time(NULL));
  while (scanf(" %s %s %s", buf + 1, s1 + 1, s2 + 1) != EOF) {
    kmp(s1, st1);
    kmp(s2, st2);
    int len = strlen(buf + 1);
    ht[0].setCallBack(h);
    ht[1].setCallBack(h);
    ht[0].clear();
    ht[1].clear();
    int ans = 0, len1 = strlen(s1 + 1), len2 = strlen(s2 + 1);
    for (int i = 1; i <= len; i++) {
      sum[0][i - 1] = sum[1][i - 1] = 0;
      for (int j = i; j <= len; j++) {
        sum[0][j] = sum[0][j - 1] * P[0] + buf[j];
        sum[1][j] = sum[1][j - 1] * P[1] + buf[j];
      }
      for (int j = i; j <= len; j++) {
        if (j - i + 1 < max(len1, len2)) continue;
        if (st1.find(i) != st1.end() && st2.find(j - len2 + 1) != st2.end()) {
          if (ht[0].find(sum[0][j]) != -1 && ht[1].find(sum[1][j]) != -1)
            continue;
          ht[0].insert(sum[0][j]);
          ht[1].insert(sum[1][j]);
          ans++;
        }
      }
    }
    cout << ans << '\n';
  }
}
