A8184 | Petr#
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
In the fourth sample identificators intersect.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted