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 s1s_{1} , the second enters an infinite loop if the input data contains the substring s2s_{2} , and the third requires too much memory if the input data contains the substring s3s_{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?

输入格式

There are exactly 3 lines in the input data. The ii -th line contains string sis_{i} . All the strings are non-empty, consists of lowercase Latin letters, the length of each string doesn't exceed 10510^{5} .

输出格式

Output one number — what is minimal length of the string, containing s1s_{1} , s2s_{2} and s3s_{3} as substrings.

输入输出样例

  • 输入#1

    ab
    bc
    cd
    

    输出#1

    4
    
  • 输入#2

    abacaba
    abaaba
    x
    

    输出#2

    11
    
首页