|
||||||||||
StringTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 1928 Accepted Submission(s): 722 Problem Description Given 3 strings A, B, C, find the longest string D which satisfy the following rules: a) D is the subsequence of A b) D is the subsequence of B c) C is the substring of D Substring here means a consecutive subsequnce. You need to output the length of D. Input The first line of the input contains an integer T(T = 20) which means the number of test cases. For each test case, the first line only contains string A, the second line only contains string B, and the third only contains string C. The length of each string will not exceed 1000, and string C should always be the subsequence of string A and string B. All the letters in each string are in lowercase. Output For each test case, output Case #a: b. Here a means the number of case, and b means the length of D. Sample Input
Sample Output
Hint For test one, D is "aaaa", and for test two, D is "acf". Source | ||||||||||
|