|
||||||||||
Two BrothersTime Limit: 6000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 718 Accepted Submission(s): 63 Problem Description Though Yueyue and Lele are brothers , they are very different. For example, Yueyue is very hard in study, especially in writing compositions. To make the composition looks nice , he will not use the same word twice. While Lele is very lazy, and he sometimes copys his brother's homework. Last week, their teacher asked them to write a composition named "My Mother", they handed the same composition. The teacher was very angry , but Lele just answered "We have the same mother , why should our compositions be different ?" Now,the teacher is asking Yueyue and Lele to write the compositions again, and he wants to calculate the length of longest common subsequence of words occuring in the two compositions. Can you help him ? Input There will be many test cases in the problem.Please process to the end of file. Each case contains two lines. The first line means Yueyue's composition and the second line means Lele's composition. Each composition will contains no more than 10^4 words . And each word will contains less than 40 characters.Each character will only be in a~z or A~Z. Two words will be separated by a blank. To make the problem easier, there will be a "#" at the end of each composition. Output For each case , output a integer in a line represents the length of longest common subsequence of words occuring in the their compositions. Sample Input
Sample Output
Hint Huge input,the C function scanf() will work better than cin Author linle Source | ||||||||||
|