#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) { return y == 0 ? x : gcd(y, x % y); }
int toInt(char xx) { return xx - '0'; }
char toChar(int xx) { return xx + '0'; }
int isDigit(char xx) { return ('0' <= xx && xx <= '9'); }
bool isCharacter(char xx) {
  return (('a' <= xx && xx <= 'z') || ('A' <= xx && xx <= 'Z'));
}
void swapInt(int &x, int &y) {
  x = x ^ y;
  y = x ^ y;
  x = x ^ y;
}
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const int Mod = 9901;
const int maxn = 2000 + 2;
int exitInput = 0;
const long long c1 = 3137, c2 = 1e9 + 3, cs = 29;
typedef char arrc[maxn];
arrc s, sbegin, send;
int len_s, len_sbegin, len_send;
arrc idx_begin, idx_end;
void read() {
  cin >> s >> sbegin >> send;
  len_s = strlen(s);
  len_sbegin = strlen(sbegin);
  len_send = strlen(send);
}
void init() {
  memset(idx_begin, 0, sizeof(idx_begin));
  memset(idx_end, 0, sizeof(idx_end));
  int i, j, k;
  for (i = 0; i < len_s; ++i) {
    k = 0;
    while (k + i < len_s && k < len_sbegin && s[k + i] == sbegin[k]) {
      k++;
    }
    if (k == len_sbegin) {
      idx_begin[i] = 1;
    }
    k = 0;
    while (k + i < len_s && k < len_send && s[k + i] == send[k]) {
      k++;
    }
    if (k == len_send) {
      idx_end[i] = 1;
    }
  }
}
void solve() {
  set<pair<long long, long long> > spll;
  long long h1, h2;
  int i, j;
  vector<pair<long long, long long> > vpll;
  for (i = 0; i < len_s; ++i) {
    if (idx_begin[i] == 1) {
      h1 = h2 = 0;
      for (j = i; j < len_s; ++j) {
        h1 = (h1 * cs + s[j] - 'a' + 1) % c1;
        h2 = (h2 * cs + s[j] - 'a' + 1) % c2;
        if (idx_end[j] == 1 && j + len_send >= i + len_sbegin) {
          vpll.push_back(pair<long long, long long>(h1, h2));
        }
      }
    }
  }
  sort(vpll.begin(), vpll.end());
  int cnt = unique(vpll.begin(), vpll.end()) - vpll.begin();
  cout << cnt << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  int ntest = 1;
  int itest = 1;
  for (itest = 1; itest <= ntest; ++itest) {
    read();
    if (exitInput) {
      break;
    }
    {}
    init();
    solve();
  }
  return 0;
}
