#include <bits/stdc++.h>
using namespace std;
const int N = 2000;
int vis[N * N / 2][26];
int len;
int la, lb;
int ans;
int x[N], y[N];
string s, a, b;
void search(int X) {
  int cur = 0;
  for (int i = X; i < s.length(); i++) {
    if (!vis[cur][s[i] - 'a']) {
      if (y[i] && i >= lb + X - 1 && i >= la + X - 1) ans++;
      vis[cur][s[i] - 'a'] = len++;
    }
    cur = vis[cur][s[i] - 'a'];
  }
}
int main() {
  cin >> s >> a >> b;
  la = a.length(), lb = b.length();
  for (int i = 0; i < s.length(); i++) {
    if (s.substr(i, la) == a) x[i] = 1;
    if (s.substr(i, lb) == b) y[i + lb - 1] = 1;
  }
  len = 1;
  ans = 0;
  for (int i = 0; i < s.length(); i++) {
    if (x[i]) search(i);
  }
  cout << ans << endl;
  return 0;
}
