SP7155 CF25E - Test
Description
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?
Input Format
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} $ .
Output Format
For each test case output one number — what is minimal length of the string, containing _s_ $ _{1} $ , _s_ $ _{2} $ and _s_ $ _{3} $ as substrings.