Petr#

题意翻译

题目描述 很久很久以前,当Petya还是一个学生汪的时候,他对Petr#语言的语法极感兴♂趣。在一堂课上Petya对如下问题产生了兴♂趣:给定字符串t,该字符串以s begin开头,s end结尾的连续子串有多少个。当且仅当子串所含字符不同时,他们被认为是不同的。它们在t中出现的位置与他们是否相同并无关系。Petya的数学并不好(???),所以他并不能得出这一数字。帮♂帮他吧! 输入输出格式 输入格式: 输入文件包含三行。 第一行为给定的字符串t。 第二行和第三行相应为s begin和s end。 以上三行都为非空的小写英文字母串。每个字母串的长度不超过2000个字母。 输出格式: 输出一个数字——不同的以s begin开头,以s end的t的子串。 由 @Segment_Tree 提供翻译

题目描述

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!

输入输出格式

输入格式


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 the only number — the amount of different substrings of $ t $ that start with $ s_{begin} $ and end with $ s_{end} $ .

输入输出样例

输入样例 #1

round
ro
ou

输出样例 #1

1

输入样例 #2

codeforces
code
forca

输出样例 #2

0

输入样例 #3

abababab
a
b

输出样例 #3

4

输入样例 #4

aba
ab
ba

输出样例 #4

1

说明

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