#include <bits/stdc++.h>
using namespace std;
const int maxn = 2010;
string t, s, e;
int lt, ls, le;
long long ans, posx;
long long indexx[maxn * maxn];
long long h[maxn][maxn];
bool smark[maxn], emark[maxn];
int main() {
  while (cin >> t >> s >> e) {
    memset(smark, 0, sizeof(smark));
    memset(emark, 0, sizeof(emark));
    memset(h, 0, sizeof(h));
    lt = t.size(), ls = s.size(), le = e.size();
    long long hash, x;
    for (int i = 0; i < lt; ++i) {
      hash = 45154352345212341ll;
      for (int j = i; j < lt; ++j) {
        hash ^= ((hash << 10) + (t[j]) + (hash >> 4));
        h[i][j] = hash & 0x7FFFFFFFFFFFFFFFll;
      }
    }
    for (int i = 0; i < lt; ++i) {
      if (t.substr(i, ls) == s) smark[i] = 1;
      if (t.substr(i, le) == e) emark[i] = 1;
    }
    posx = 0;
    for (int i = 0; i < lt; ++i)
      for (int j = i; j < lt; ++j)
        if (smark[i] && emark[j] && i + ls <= j + le)
          indexx[++posx] = h[i][j + le - 1];
    sort(indexx + 1, indexx + posx + 1);
    if (posx) ans = 1;
    for (int i = 2; i <= posx; ++i)
      if (indexx[i] != indexx[i - 1]) ++ans;
    cout << ans << endl;
  }
  return 0;
}
