#include <bits/stdc++.h>
using namespace std;
long long labs(long long a) { return a < 0 ? (-a) : a; }
long long max(long long a, long long b) { return a > b ? a : b; }
long long min(long long a, long long b) { return a < b ? a : b; }
const unsigned long long OSN = 31;
const int MAXN = 2002;
vector<unsigned long long> osn;
unsigned long long GetCode(char c) { return c - 'a' + 1; }
void Init() {
  osn.resize(MAXN);
  for (int(i) = 0; (i) < (MAXN); (i)++) {
    osn[i] = (i == 0 ? 1 : osn[i - 1] * OSN);
  }
}
struct Hash {
  vector<unsigned long long> h;
  void Build(const string& s) {
    h.resize(s.size());
    for (int(i) = 0; (i) < (s.size()); (i)++) {
      h[i] = (i == 0 ? 0 : h[i - 1]) + GetCode(s[i]) * osn[i];
    }
  }
  unsigned long long GetHash(int i, int j) {
    return (h[j] - (i == 0 ? 0 : h[i - 1])) * osn[MAXN - 1 - i];
  }
};
Hash hb, he, h;
set<unsigned long long> ss[MAXN];
int main() {
  Init();
  string s, begin, end;
  cin >> s >> begin >> end;
  h.Build(s);
  hb.Build(begin);
  he.Build(end);
  int bsize = begin.size();
  int esize = end.size();
  unsigned long long bhash = hb.GetHash(0, bsize - 1);
  unsigned long long ehash = he.GetHash(0, esize - 1);
  unsigned long long hash;
  for (int(i) = 0; (i) < (s.size()); (i)++) {
    for (int j = i + max(bsize, esize) - 1; j < s.size(); j++) {
      if (bhash == h.GetHash(i, i + bsize - 1) &&
          ehash == h.GetHash(j - esize + 1, j)) {
        ss[j - i].insert(h.GetHash(i, j));
      }
    }
  }
  long long res = 0;
  for (int(i) = 0; (i) < (MAXN); (i)++) {
    res += ss[i].size();
  }
  cout << res;
  return 0;
}
