Substring Scoring
View as PDFYou are given three strings, . We will define the score of a substring 
 of 
 as the sum of the length of the longest suffix of 
 that is a prefix of 
 and the length of the longest prefix of 
 that is a suffix of 
. Find the highest possible score of any such substring of 
. Each string will only contain lowercase letters.
Subtasks
- (40 points) 
 - (60 points) 
 
Input Specification
The first line will contain the string , the second will contain 
, and the third 
.
Output Specification
A single integer, denoting the largest achievable score of any substring of .
Sample Input 1
abc
abcdef
f
Sample Output 1
4
Sample Input 2
aa
aa
aa
Sample Output 2
4
Comments