#include <bits/stdc++.h>
using namespace std;
unordered_set<int> strs[2012];
char str[2010], beg[2010], en[2010];
int hsh[2010][2010], n, m, s;
int imod(long long a) {
  int b = a % 1025434309;
  if (b < 0) b += 1025434309;
  return b;
}
int modexp(int power) {
  if (!power) return 1;
  long long x = modexp(power / 2);
  x = (x * x) % 1025434309;
  if (power % 2) x = (x * 957123577) % 1025434309;
  return x;
}
int str_hash(char a[], int len) {
  int hp = 0;
  for (int i = 0; i < len; i++) {
    hp = imod(1LL * hp * 957123577);
    hp = imod(hp + a[i]);
  }
  return hp;
}
void hashing(int len) {
  int hp = 0;
  int e = modexp(len - 1);
  for (int i = 0; i < len; i++) {
    hp = imod(1LL * hp * 957123577);
    hp = imod(hp + str[i]);
  }
  hsh[0][len - 1] = hp;
  for (int i = 0; i < n - len; i++) {
    hp = imod(hp - 1LL * str[i] * e);
    hp = imod(1LL * hp * 957123577);
    hp = imod(hp + str[i + len]);
    hsh[i + 1][i + len] = hp;
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> str >> beg >> en;
  int ha, hb, la[2010], lb[2010], pointa = 0, pointb = 0;
  n = strlen(str);
  m = strlen(beg);
  s = strlen(en);
  for (int i = 1; i < n + 1; i++) hashing(i);
  ha = str_hash(beg, m);
  hb = str_hash(en, s);
  for (int i = 0; i < n; i++)
    for (int j = i; j < n; j++) {
      if (hsh[i][j] == ha && j - i + 1 == m) {
        la[pointa] = j;
        pointa++;
      }
      if (hsh[i][j] == hb && j - i + 1 == s) {
        lb[pointb] = j;
        pointb++;
      }
    }
  for (int i = 0; i < pointa; i++)
    for (int j = 0; j < pointb; j++) {
      if (la[i] <= lb[j] && la[i] - m <= lb[j] - s)
        strs[lb[j] - la[i] + m].insert(hsh[la[i] - m + 1][lb[j]]);
    }
  int sum = 0;
  for (int i = 0; i < 2001; i++) sum += strs[i].size();
  cout << sum << "\n";
  return 0;
}
