#include <bits/stdc++.h>
using namespace std;
class Trie {
 public:
  class Node {
   public:
    Node* letters[26];
    bool end;
    Node() : end(false) {
      for (int i = 0; i < 26; i++) letters[i] = NULL;
    }
  };
  Node* root;
  Trie() : root(new Node()) {}
  bool find(char* s, int b, int l) {
    Node* n = this->root;
    for (int i = 0; i < l; i++) {
      if (n->letters[s[b + i] - 'a'] != NULL) {
        n = n->letters[s[b + i] - 'a'];
      } else
        return false;
    }
    return n->end;
  }
  bool insert(char* s, int b, int l, Node*& n) {
    int i;
    for (i = 0; i < l; i++) {
      if (n->letters[s[b + i] - 'a'] != NULL) {
        n = n->letters[s[b + i] - 'a'];
      } else
        break;
    }
    if (i == l && n->end) return false;
    for (; i < l; i++) {
      n = n->letters[s[b + i] - 'a'] = new Node();
    }
    n->end = true;
    return true;
  }
} t;
char s[2002], a[2002], b[2002];
int n, na, nb;
vector<int> ia, ib;
int main() {
  cin >> s >> a >> b;
  n = (int)strlen(s);
  na = (int)strlen(a);
  nb = (int)strlen(b);
  for (int i = 0; i < n - na + 1; i++) {
    bool ug = true;
    for (int j = 0; j < na && ug; j++) {
      if (s[i + j] != a[j]) ug = false;
    }
    if (ug) ia.push_back(i);
  }
  for (int i = 0; i < n - nb + 1; i++) {
    bool ug = true;
    for (int j = 0; j < nb && ug; j++) {
      if (s[i + j] != b[j]) ug = false;
    }
    if (ug) ib.push_back(i);
  }
  int cnt = 0;
  for (int i = 0; i < ia.size(); i++) {
    Trie::Node* p = t.root;
    int lprec = 0;
    for (int j = 0; j < ib.size(); j++) {
      if (ia[i] <= ib[j] && ia[i] + na <= ib[j] + nb) {
        if (t.insert(s, ia[i] + lprec, ib[j] + nb - ia[i] - lprec, p)) {
          cnt++;
        }
        lprec = ib[j] + nb - ia[i];
      }
    }
  }
  cout << cnt;
}
