当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1758:Two Brothers

题目描述
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 ?
输入解释
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.
输出解释
For each case , output a integer in a line represents the length of longest common subsequence of words occuring in the their compositions.
输入样例
aa bb cc #
aa cc bb #
输出样例
2

提示
Huge input,the C function scanf() will work better than cin
来自杭电HDUOJ的附加信息
Author linle
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-1758

最后修改于 2020-10-25T22:47:42+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
6000/2000MS(Java/Others) 32768/32768K(Java/Others)