CF25E - Test

题意翻译

### 题目翻译 Bob 出了一道字符串题,题目的输入是一个字符串。 毒瘤的 Bob 写了 $3$ 个程序,但他发现了一个悲剧: 1. 当输入的字符串有子串 $s_1$ 时,程序 $1$ 会 WA; 1. 当输入的字符串有子串 $s_2$ 时,程序 $2$ 会死循环; 1. 当输入的字符串有子串 $s_3$ 时,程序 $3$ 会 MLE。 当然,可以假定其他情况下程序不会出锅。 Bob 非常毒瘤,他想找一个最短的输入字符串 $ss$,使得 $3$ 个程序都过不了。请输出最小的长度。 #### 输入格式 **多组数据**,每组数据 $3$ 行,每行一个字符串,分别代表 $s_1,s_2,s_3$,只含小写字母。 #### 输出格式 对于每组数据,输出一个整数代表最小长度,然后换行。 #### 数据规模与约定 对于 $100\%$ 的数据, $1\leq |s_1|,|s_2|,|s_3|\leq 10^5$。

题目描述

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?

输入输出格式

输入格式


There are several test cases. For each test case there are exactly 3 lines. 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} $ .

输出格式


For each test case output one number — what is minimal length of the string, containing _s_ $ _{1} $ , _s_ $ _{2} $ and _s_ $ _{3} $ as substrings.

输入输出样例

输入样例 #1

ab
bc
cd
abacaba
abaaba
x

输出样例 #1

4
11