#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
const double eps = 1e-9;
char buf[2100], start[2100], ende[2100];
bool sok[2100], eok[2100];
int edp[4100];
int B, S, E;
int main() {
  scanf("%s%s%s", buf, start, ende);
  B = strlen(buf);
  S = strlen(start);
  E = strlen(ende);
  for (int i = (0); i < (B + 1); i++) {
    sok[i] = true;
    if (i + S > B) {
      sok[i] = false;
    } else {
      for (int j = (0); j < (S); j++)
        if (buf[i + j] != start[j]) {
          sok[i] = false;
          break;
        }
    }
  }
  for (int i = (0); i < (B + 1); i++) {
    eok[i] = true;
    if (i < E) {
      eok[i] = false;
    } else {
      for (int j = (0); j < (E); j++)
        if (buf[i - E + j] != ende[j]) {
          eok[i] = false;
          break;
        }
    }
  }
  edp[0] = 0;
  for (int i = (0); i < (B); i++) edp[i + 1] = edp[i] + eok[i + 1];
  for (int i = (0); i < (2050); i++) edp[B + i] = edp[B];
  set<string> used = set<string>();
  int res = 0;
  for (int i = int(B) - 1; i >= (0); i--)
    if (sok[i]) {
      string cur(&(buf[i]));
      used.insert(cur);
      set<string>::iterator it = used.find(cur), it2, it3;
      it2 = it3 = it;
      int mlen = max(S, E) - 1;
      if (it2 != used.begin()) {
        --it2;
        int len = int((*it2).size());
        for (int j = (0); j < (len); j++)
          if (cur[j] != (*it2)[j]) len = j;
        mlen = max(mlen, len);
      }
      it3++;
      if (it3 != used.end()) {
        int len = int((*it3).size());
        for (int j = (0); j < (len); j++)
          if (cur[j] != (*it3)[j]) len = j;
        mlen = max(mlen, len);
      }
      res = res + edp[B] - edp[i + mlen];
    }
  cout << res << endl;
  return 0;
}
