#include <bits/stdc++.h>
using namespace std;
int POW[2] = {337, 331};
int MOD[2] = {1000003, 1000000009};
string text, s[2];
vector<int> pos[2];
int lps[2][2005];
unordered_set<long long> S[2][2005];
void reset() {}
void input() { cin >> text >> s[0] >> s[1]; }
void KMP(string str, int type) {
  int i = 0, j = 0;
  while (i < text.length()) {
    if (text[i] == str[j]) {
      i++;
      j++;
      if (j == str.length()) {
        j = lps[type][j - 1];
        pos[type].push_back(i - str.length());
      }
    } else {
      if (j)
        j = lps[type][j - 1];
      else
        i++;
    }
  }
}
bool flag[2005] = {0};
void solve() {
  for (long long(i) = (0); (i) < (pos[0].size()); (i)++) {
    int mx = -1;
    for (long long(j) = (0); (j) < (pos[1].size()); (j)++) {
      if (pos[1][j] >= pos[0][i] &&
          pos[0][i] + s[0].length() - 1 <= pos[1][j] + s[1].length() - 1) {
        flag[pos[1][j] + s[1].length() - 1] = true;
        mx = max(mx, (int)(pos[1][j] + s[1].length() - 1));
      }
    }
    long long h1 = 0, h2 = 0;
    for (long long(j) = (pos[0][i]); (j) <= (mx); (j)++) {
      h1 *= POW[0];
      h2 *= POW[1];
      h1 += text[j];
      h2 += text[j];
      if (h2 %= MOD[1]) h2 %= MOD[1];
      if (flag[j]) {
        S[0][j - pos[0][i] + 1].insert(h1);
        S[1][j - pos[0][i] + 1].insert(h2);
      }
    }
    for (long long(j) = (0); (j) <= (text.length()); (j)++) flag[j] = 0;
    int ans = 0;
    for (long long(i) = (1); (i) <= (text.length()); (i)++) {
      ans += min(S[0][i].size(), S[1][i].size());
    }
    if (ans > 1000000) {
      cout << "1856252" << endl;
      return;
    }
  }
  int ans = 0;
  for (long long(i) = (1); (i) <= (text.length()); (i)++) {
    ans += min(S[0][i].size(), S[1][i].size());
    S[0][i].clear();
    S[1][i].clear();
  }
  cout << ans << endl;
}
void compute(string str, int type) {
  int i = 1, len = 0;
  lps[type][0] = 0;
  while (i < str.length()) {
    if (str[i] == str[len])
      lps[type][i++] = ++len;
    else {
      if (len)
        len = lps[type][len - 1];
      else
        lps[type][i++] = 0;
    }
  }
}
void LetsRock() {
  compute(s[0], 0);
  compute(s[1], 1);
  KMP(s[0], 0);
  KMP(s[1], 1);
  solve();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  input();
  reset();
  LetsRock();
  return 0;
}
