#include <bits/stdc++.h>
using namespace std;
const int N = 2000 + 7;
pair<int, int> base = {12345, 54321};
pair<int, int> mod = {123456789, 987654321};
string s, t;
pair<int, int> p[N * N];
bool mark[N];
int main() {
  ios::sync_with_stdio(false);
  cin >> s >> t;
  int n = s.size();
  int m = t.size();
  for (int i = 0; i + m - 1 < n; i++) {
    bool flag = true;
    for (int j = 0; j < m; j++)
      if (t[j] != s[i + j]) flag = false;
    if (flag) mark[i] = true;
  }
  int x = m, cnt = 0;
  cin >> t;
  m = t.size();
  for (int i = m - 1; i < n; i++) {
    bool flag = true;
    for (int j = 0; j < m; j++)
      if (t[j] != s[i - (m - 1) + j]) flag = false;
    if (flag) {
      pair<int, int> hs = {0, 0};
      for (int j = i; j >= 0; j--) {
        hs = {(1LL * hs.first * base.first + s[j]) % mod.first,
              (1LL * hs.second * base.second + s[j]) % mod.second};
        if (mark[j] && x <= i - j + 1 && m <= i - j + 1) p[cnt++] = hs;
      }
    }
  }
  sort(p, p + cnt);
  cout << unique(p, p + cnt) - p << "\n";
  return 0;
}
