String
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 122 Accepted Submission(s): 48
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
2 aaaaa aaaa aa abcdef acebdf cf
Sample Output
Hint
Source
2013 Multi-University Training Contest 8
Recommend
zhuyuanchen520
思路:AB公共+子串+AB公共
其实挺水的,居然没出,最后一小时想出来了,敲完代码还剩15分钟提交,出了个BUG,差了17秒再次提交果断悲剧了。
调的不忍直视