CF113B.Petr#

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 sbegins_{begin} and ending with the sends_{end} (it is possible sbegin=sends_{begin}=s_{end} ), the given string tt 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 tt . The second and the third lines contain the sbegins_{begin} and sends_{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 tt that start with sbegins_{begin} and end with sends_{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.

首页