#include <bits/stdc++.h>
using namespace std;
int tri[2000000][26];
int st[2003], ed[2003], vis[2000000];
char s1[2003], s2[2003], s3[2003];
int main() {
  gets(s1);
  gets(s2);
  gets(s3);
  int l1 = strlen(s1);
  int l2 = strlen(s2);
  int l3 = strlen(s3);
  for (int i = 0; i + l2 < l1 + 1; i++) {
    for (int j = i; j < i + l2; j++) {
      if (s1[j] != s2[j - i]) goto st;
    }
    st[i] = 1;
  st:;
  }
  for (int i = l1 - 1; i >= l3 - 1; i--) {
    for (int j = i - l3 + 1; j <= i; j++) {
      if (s1[j] != s3[j - i + l3 - 1]) goto sq;
    }
    ed[i] = 1;
  sq:;
  }
  int k = 1, r = 0;
  for (int i = 0; i < l1; i++) {
    if (st[i]) {
      int p = 0;
      for (int j = i; j < i + max(l2, l3) - 1; j++) {
        if (!tri[p][s1[j] - 'a']) tri[p][s1[j] - 'a'] = k++;
        p = tri[p][s1[j] - 'a'];
      }
      for (int j = i + max(l2, l3) - 1; j < l1; j++) {
        if (!tri[p][s1[j] - 'a']) tri[p][s1[j] - 'a'] = k++;
        p = tri[p][s1[j] - 'a'];
        if (ed[j]) {
          if (!vis[p]) {
            r++;
            vis[p] = 1;
          }
        }
      }
    }
  }
  printf("%d\n", r);
}
