import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.
lang.
Math.
*; import static java.
util.
Arrays.
*;
public class B{
Scanner sc
=new Scanner
(System.
in);
int INF=1<<28;
double EPS=1e-9;
void run(){
int n=s.length();
long[] coes=new long[n];
coes[n-1]=1;
for(int i=n-2; i>=0; i--){
coes[i]=coes[i+1]*31;
}
long[] hashes=new long[n*n];
int k=0;
LinkedList<Integer> ss=new LinkedList<Integer>();
LinkedList<Integer> es=new LinkedList<Integer>();
for(int i=s.indexOf(start); i>=0; i=s.indexOf(start, i+1)){
ss.add(i);
}
for(int i=s.indexOf(end); i>=0; i=s.indexOf(end, i+1)){
es.add(i);
}
for(int ks : ss){
int i=ks;
long hash=0;
for(int ke : es){
if(ks<=ke&&ks+start.length()<=ke+end.length()){
for(; i<ke+end.length(); i++){
hash+=(s.charAt(i))*coes[i-ks];
}
hashes[k++]=hash;
}
}
}
sort(hashes);
long ph=hashes[0]+1;
int ans=0;
for(long h : hashes){
if(h!=ph){
ans++;
}
ph=h;
}
ans--;
println(ans+"");
}
}
}
}
public static void main
(String[] args
){ new B().run();
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLm1hdGguKjsKaW1wb3J0IGphdmEuaW8uKjsKCmltcG9ydCBzdGF0aWMgamF2YS5sYW5nLk1hdGguKjsKaW1wb3J0IHN0YXRpYyBqYXZhLnV0aWwuQXJyYXlzLio7CgpwdWJsaWMgY2xhc3MgQnsKCVNjYW5uZXIgc2M9bmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKCglpbnQgSU5GPTE8PDI4OwoJZG91YmxlIEVQUz0xZS05OwoKCXZvaWQgcnVuKCl7CgkJU3RyaW5nIHM9c2MubmV4dCgpOwoJCVN0cmluZyBzdGFydD1zYy5uZXh0KCk7CgkJU3RyaW5nIGVuZD1zYy5uZXh0KCk7CgoJCWludCBuPXMubGVuZ3RoKCk7CgoJCWxvbmdbXSBjb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