#include <bits/stdc++.h>
using namespace std;
const int Maxn = 2000 + 10;
const long long Mod[2] = {1000 * 1000 * 1000 + 7, 1000 * 1000 * 1000 + 9};
string s[3];
long long n, m, k, base[2], prs[2][3][Maxn], powee[2][Maxn], ans;
vector<pair<int, int> > vec;
void hsh(int a, int b) {
  long long p = 1;
  for (int i = 1; i <= s[a].size(); i++) {
    powee[b][i - 1] = p;
    prs[b][a][i] =
        (prs[b][a][i - 1] + (p * (s[a][i - 1] - 'a' + 1)) % Mod[b]) % Mod[b];
    p *= base[b];
    p %= Mod[b];
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> s[0] >> s[1] >> s[2];
  n = (int)s[0].size(), m = (int)s[1].size(), k = (int)s[2].size();
  srand(time(0));
  base[0] = rand() % 70 + 30, base[1] = rand() % 70 + 30;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 3; j++) hsh(j, i);
  for (int f = 0; f < n; f++)
    for (int e = f; e < n; e++)
      if (e - f + 1 >= max(m, k)) {
        if ((prs[0][0][e + 1] - prs[0][0][e - k + 1] + Mod[0]) % Mod[0] ==
                (prs[0][2][k] * powee[0][e - k + 1]) % Mod[0] &&
            (prs[1][0][e + 1] - prs[1][0][e - k + 1] + Mod[1]) % Mod[1] ==
                (prs[1][2][k] * powee[1][e - k + 1]) % Mod[1]) {
          if ((prs[0][0][m + f] - prs[0][0][f] + Mod[0]) % Mod[0] ==
                  (prs[0][1][m] * powee[0][f]) % Mod[0] &&
              (prs[1][0][m + f] - prs[1][0][f] + Mod[1]) % Mod[1] ==
                  (prs[1][1][m] * powee[1][f]) % Mod[1]) {
            vec.push_back(make_pair(
                (((prs[0][0][e + 1] - prs[0][0][f] + Mod[0]) % Mod[0]) *
                 powee[0][n - f - 1]) %
                    Mod[0],
                (((prs[1][0][e + 1] - prs[1][0][f] + Mod[1]) % Mod[1]) *
                 powee[1][n - f - 1]) %
                    Mod[1]));
            ans++;
          }
        }
      }
  sort(vec.begin(), vec.end());
  if (!vec.empty()) ans = 1;
  for (int i = 1; i < (int)vec.size(); i++)
    if (vec[i] != vec[i - 1]) ans++;
  cout << ans << endl;
  return 0;
}
