题库练习 Test
← 上一题 下一题 →

A7824 | Test

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Sometimes it is hard to prepare tests for programming problems. Now Bob is preparing tests to new problem about strings — input data to his problem is one string. Bob has 3 wrong solutions to this problem. The first gives the wrong answer if the input data contains the substring $s_{1}$ , the second enters an infinite loop if the input data contains the substring $s_{2}$ , and the third requires too much memory if the input data contains the substring $s_{3}$ . Bob wants these solutions to fail single test. What is the minimal length of test, which couldn't be passed by all three Bob's solutions?
有时,为编程问题准备测试很困难。现在,鲍勃正在为有关字符串的新问题准备测试--问题的输入数据是一个字符串。对于这个问题,鲍勃有三种错误的解决方案。如果输入数据中包含子串 s1 ,第一个方案就会给出错误答案;如果输入数据中包含子串 s2 ,第二个方案就会进入无限循环;如果输入数据中包含子串 s3 ,第三个方案就会占用过多内存。鲍勃希望这些解决方案都不能通过单项测试。鲍勃的三个解决方案都不能通过的最小测试长度是多少?

输入格式

There are exactly 3 lines in the input data. The $i$ -th line contains string $s_{i}$ . All the strings are non-empty, consists of lowercase Latin letters, the length of each string doesn't exceed $10^{5}$ .
输入
输入数据中正好有 3 行。第 i 行包含字符串 si 。所有字符串都是非空字符串,由小写拉丁字母组成,每个字符串的长度不超过 $10^{5}$ 。

输出格式

Output one number — what is minimal length of the string, containing $s_{1}$ , $s_{2}$ and $s_{3}$ as substrings.
输出
输出一个数字 - 字符串的最小长度,包含 s1 、 s2 和 s3 作为子串。

输入输出样例

输入 #1
ab
bc
cd
输出 #1
4
输入 #2
abacaba
abaaba
x
输出 #2
11
C++ 编辑器
输入
输出