Codeforces Beta Round 86 (Div. 2 Only)
D
Petr#
Codeforces
未评级
原题
← CE →
翻译中…

Long ago, when Petya was a schoolboy, he was very much interested in the Petr# language grammar. During one lesson Petya got interested in the following question: how many different continuous substrings starting with the $*s*_{*begin*}$ and ending with the $*s*_{*end*}$ (it is possible $*s*_{*begin*} = *s*_{*end*}$), the given string $*t*$ has. Substrings are different if and only if their contents aren't equal, their positions of occurence don't matter. Petya wasn't quite good at math, that's why he couldn't count this number. Help him!

翻译中…

Input

翻译中…

The input file consists of three lines. The first line contains string $*t*$. The second and the third lines contain the $*s*_{*begin*}$ and $*s*_{*end*}$ identificators, correspondingly. All three lines are non-empty strings consisting of lowercase Latin letters. The length of each string doesn't exceed 2000 characters.

翻译中…

Output

翻译中…

Output the only number — the amount of different substrings of $*t*$ that start with $*s*_{*begin*}$ and end with $*s*_{*end*}$.

翻译中…

Note

翻译中…

In the third sample there are four appropriate different substrings. They are: ab, abab, ababab, abababab.

翻译中…

In the fourth sample identificators intersect.

翻译中…

样例

Input #1
round
ro
ou
Output #1
1
InputCopy OutputCopy
Input #2
codeforces
code
forca
Output #2
0
InputCopy OutputCopy
Input #3
abababab
a
b
Output #3
4
InputCopy OutputCopy
Input #4
aba
ab
ba
Output #4
1
InputCopy OutputCopy
题目信息
题号
114D
时间限制
2 s
内存限制
256 MB

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。