#include <bits/stdc++.h>
int dr[] = {2, 2, -2, -2, 1, -1, 1, -1};
int dc[] = {1, -1, 1, -1, 2, 2, -2, -2};
int dr1[] = {0, 0, 0, 1, 1, 1, -1, -1, -1};
int dc1[] = {-1, 0, 1, -1, 0, 1, -1, 0, 1};
int dr2[] = {0, 0, 1, -1};
int dc2[] = {1, -1, 0, 0};
using namespace std;
long long int siz, last;
struct automata {
  long long int len, link, next[26];
} st[2005 * 2];
void inser(char c) {
  long long int now = ++siz;
  st[now].len = st[last].len + 1;
  long long int p, q, cl;
  for (p = last; p != -1 && !st[p].next[c]; p = st[p].link) st[p].next[c] = now;
  if (p == -1)
    st[now].link = 0;
  else {
    q = st[p].next[c];
    if (st[p].len + 1 == st[q].len)
      st[now].link = q;
    else {
      cl = ++siz, st[cl].len = st[p].len + 1;
      st[cl].link = st[q].link;
      memcpy(st[cl].next, st[q].next, sizeof(st[cl].next));
      for (; p != -1 && st[p].next[c] == q; p = st[p].link) st[p].next[c] = cl;
      st[now].link = st[q].link = cl;
    }
  }
  last = now;
}
long long int dp[2005 * 2];
string t, t1, t2;
void dfs(long long int x) {
  long long int i;
  long long int now1 = x;
  bool f = 0;
  for (i = 0; i < t2.size(); i++) {
    long long int p = st[now1].next[t2[i] - 'a'];
    if (p == 0) {
      f = 1;
      break;
    }
    now1 = p;
  }
  dp[x] = (f == 0);
  for (i = 0; i < 26; i++) {
    long long int p = st[x].next[i];
    if (p == 0) continue;
    dfs(p);
    dp[x] += dp[p];
  }
}
int main() {
  long long int i, j;
  siz = 0;
  memset(st, 0, sizeof(st));
  st[0].link = -1;
  cin >> t >> t1 >> t2;
  for (i = 0; i < t.size(); i++) inser(t[i] - 'a');
  dfs(0);
  long long int now1 = 0;
  long long int ans = 0;
  for (i = 0; i < t1.size(); i++) {
    long long int p = st[now1].next[t1[i] - 'a'];
    if (p == 0) {
      cout << "0" << endl;
      return 0;
    }
    now1 = p;
  }
  long long int r1 = t1.size();
  long long int r2 = t2.size();
  for (i = 1; i <= min(t1.size(), t2.size()); i++) {
    bool f = 0;
    long long int j1 = r1 - i, j2 = 0;
    for (j = 0; j < i; j++) {
      if (t1[j1] != t2[j2]) {
        f = 1;
        break;
      }
      j1++, j2++;
    }
    if (f == 1) continue;
    long long int now2 = now1;
    f = 0;
    for (j = i; j < r2; j++) {
      long long int p = st[now2].next[t2[j] - 'a'];
      if (p == 0) {
        f = 1;
        break;
      }
      now2 = p;
    }
    if (f == 0) ans++;
  }
  dfs(now1);
  ans += dp[now1];
  cout << ans << endl;
}
