#include <bits/stdc++.h>
using namespace std;
vector<int> kmp1;
vector<int> kmp2;
string s;
string s1;
string s2;
vector<int> get(string p) {
  int m = p.length();
  vector<int> b(m);
  for (int i = 1, k = 0; i < (int)p.length(); i++) {
    while (k > 0 && p[k] != p[i]) k = b[k - 1];
    if (p[k] == p[i])
      b[i] = ++k;
    else
      b[i] = k;
  }
  return b;
}
typedef struct tri {
  tri* a[26];
  tri() { memset(a, 0, sizeof a); }
  void insert(int i) {
    if (i == s.length()) return;
    if (a[s[i] - 'a'] == 0) {
      a[s[i] - 'a'] = new tri();
    }
    a[s[i] - 'a']->insert(i + 1);
  }
  long long getAns(int k1, int k2) {
    long long ans = 0;
    for (int i = 0; i < 26; i++) {
      int kk2 = k2;
      char c = (char)(i + 'a');
      if (a[i] == 0 || (k1 < s1.length() && s1[k1] != c)) continue;
      while (kk2 > 0 && s2[kk2] != c) kk2 = kmp2[kk2 - 1];
      if (s2[kk2] == c) kk2++;
      if (kk2 == s2.length())
        ans += a[i]->getAns(k1 + 1, kmp2[kk2 - 1]) +
               (k1 + 1 >= s1.length() ? 1 : 0);
      else
        ans += a[i]->getAns(k1 + 1, kk2);
    }
    return ans;
  }
} tri;
int main() {
  cin >> s >> s1 >> s2;
  kmp1 = get(s1);
  kmp2 = get(s2);
  tri t;
  for (int i = 0; i < s.length(); i++) t.insert(i);
  long long k = t.getAns(0, 0);
  cout << k;
}
