There are three types of error which generally occurs during solving a problem those are a) wrong answer b) Time Limit Exceeded c) Memory Limit Exceeded Samrat is a pepcoder and solved a common problem using 3 solutions where 1st solution with input as s1 gives error a, 2nd solution with input as s2 gives error b, 3rd solution with input as s3 gives error c. Now he wants these solution to fail single test. What is the minimal length of test, which couldn't be passed by all three Samrat solutions?
Input Format
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 10^5.
Output Format
Output one number what is minimal length of the string, containing s1, s2 and s3 as substrings.
Constraints
s1.length()<10^5 s2.length()<10^5 s3.length()<10^5
Notice
NA
Example
Input
ab bc cd
Output
4