Once upon a time there were two brothers B1 and B2, they had many similarities like studying in same college, same class and then same AIEEE rank. They study in a college where everyone is given a unique string which is called as 'trait'.
On a sunny day of May they had a fight with some guy BDE.
So you know as per their college's convention, they had to appear in DISCO.
DISCO members were not able to find the extent of their guilt. So they devised a formula to find the guilt of the brothers.
You being their security incharge are given the task.
The task is to find the guilt.
And
guilt = Length of Longest common subsequence of traits
of B1 and B2 which is not a super-string of trait of BDE.
Super String explanation - if B is a substring of A, then A is called as super string of B.
You will be given three strings, first two of them represents traits of B1 and B2, the third string represents trait of BDE.
You have to find the length of longest common subsequence of B1 and B2, which is not a super string of BDE.
Example:
Input:
agze
agze
gz
Ouput:
3
LCS of agze and agze in which gz doesn't appear as a substring can be age and aze, both are of length 3, so maximum length is 3.
Input:
First line contains trait of B1.
Second line contains trait of B2.
Third line contains trait of BDE.
Output:
Length of Longest Common Subsequence of B1 and B2 ,which is not Super string of BDE.
Constraints:
1 <= Len(B1), Len(B2), Len(BDE) <= 100
All strings contain lower case letters only.
There is no possible subsequence of abcbe and zbby, in which b doesn't appear as substring.