CF25E.Test
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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 s1 , the second enters an infinite loop if the input data contains the substring s2 , and the third requires too much memory if the input data contains the substring s3 . 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 si . All the strings are non-empty, consists of lowercase Latin letters, the length of each string doesn't exceed 105 .
输入
输入数据中正好有 3 行。第 i 行包含字符串 si 。所有字符串都是非空字符串,由小写拉丁字母组成,每个字符串的长度不超过 105 。
输出格式
Output one number — what is minimal length of the string, containing s1 , s2 and s3 as substrings.
输出
输出一个数字 - 字符串的最小长度,包含 s1 、 s2 和 s3 作为子串。
输入输出样例
输入#1
ab bc cd
输出#1
4
输入#2
abacaba abaaba x
输出#2
11