#include <bits/stdc++.h>
using namespace std;
string s, a, b;
bool fa[2010], fb[2010];
int dp[2010][2010];
int mx[2010];
int main() {
  while (cin >> s >> a >> b) {
    int n = s.length();
    memset(fa, false, sizeof fa);
    memset(fb, false, sizeof fb);
    for (int i = 0; i < n; i++) {
      if (i + (int)a.length() <= n && s.substr(i, (int)a.length()) == a)
        fa[i] = true;
      if (i + (int)b.length() <= n && s.substr(i, (int)b.length()) == b)
        fb[i] = true;
    }
    memset(dp, 0, sizeof dp);
    memset(mx, 0, sizeof mx);
    for (int i = n - 1; i >= 0; i--) {
      for (int j = n - 1; j > i; j--) {
        if (s[i] == s[j])
          dp[i][j] = dp[i + 1][j + 1] + 1;
        else
          dp[i][j] = 0;
        mx[j] = max(mx[j], dp[i][j]);
      }
    }
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
      if (i < a.length() || i < b.length()) continue;
      for (int j = 0; j + i - 1 < n; j++) {
        if (mx[j] >= i) continue;
        if (fa[j] && fb[j + i - b.length()]) cnt++;
      }
    }
    cout << cnt << endl;
  }
  return 0;
}
