#include <bits/stdc++.h>
using namespace std;
long long pwr1[2005];
const int prime1 = 31;
long long hash1[2005];
long long init(string s) {
  hash1[0] = s[0];
  for (int i = 1; i < s.size(); i++) {
    hash1[i] = (hash1[i - 1] * prime1 + s[i]) % 1000000007;
  }
  return hash1[(int)s.size() - 1];
}
int main() {
  ios::sync_with_stdio(0);
  pwr1[0] = 1;
  for (int i = 1; i < 2005; ++i) {
    pwr1[i] = (pwr1[i - 1] * prime1) % 1000000007;
  }
  string s, a, b;
  cin >> s;
  cin >> a >> b;
  long long starting = init(a);
  long long ending = init(b);
  long long mainstring = init(s);
  int sz = a.size();
  int temp = s.size();
  vector<int> start;
  for (int i = 0; i < temp - sz + 1; ++i) {
    int first = i - 1;
    int last = first + sz;
    long long value = 0;
    if (first < 0) {
      value = hash1[last];
    } else {
      value =
          ((hash1[last] - hash1[first] * pwr1[sz]) % 1000000007 + 1000000007);
      if (value >= 1000000007) {
        value -= 1000000007;
      }
    }
    if (value == starting) {
      start.push_back(first);
    }
  }
  vector<int> endi;
  sz = b.size();
  for (int i = 0; i < temp - sz + 1; ++i) {
    int first = i - 1;
    int last = first + sz;
    long long value = 0;
    if (first < 0) {
      value = hash1[last];
    } else {
      value =
          ((hash1[last] - hash1[first] * pwr1[sz]) % 1000000007 + 1000000007);
      if (value >= 1000000007) {
        value -= 1000000007;
      }
    }
    if (value == ending) {
      endi.push_back(last);
    }
  }
  if (endi.size() == 0 || start.size() == 0) {
    cout << 0 << endl;
  } else {
    unordered_map<long long, int> ans[2002];
    int sz = max(a.size(), b.size());
    int start_size, end_size;
    start_size = start.size();
    end_size = endi.size();
    for (int i = 0; i < start_size; ++i) {
      for (int j = 0; j < end_size; ++j) {
        long long last = endi[j], first = start[i];
        if (last <= first || last < sz + first) continue;
        long long p =
            (hash1[last] - hash1[first] * pwr1[last - first]) % 1000000007;
        p += 1000000007;
        if (p >= 1000000007) {
          p -= 1000000007;
        }
        ans[last - first].insert({p, 0});
      }
    }
    int answer = 0;
    for (int i = 0; i < 2002; i++) {
      answer += ans[i].size();
    }
    cout << answer << endl;
  }
}
