#D. 最长公共子序列

    Type: Default 1000ms 128MiB

最长公共子序列

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

现在给出两个序列X和Y,你的任务是找到X和Y的最大公共子序列,也就是说要找到一个最长的序列Z,使得Z既是X的子序列也是Y的子序列。

输入

输入包括多组测试数据。(数据不超过100组)

每组数据包括一行,给出两个长度不超过200的字符串,表示两个序列。两个字符串之间由若干个空格隔开。

输出

对每组输入数据,输出一行,给出两个序列的最大公共子序列的长度。

样例

abcfbc abfcab
programming contest 
abcd mnp
4
2
0

周日9:00 阶段测试24-12-28

Not Attended
Status
Done
Rule
OI
Problem
6
Start at
2024-12-28 13:00
End at
2025-1-5 21:00
Duration
200 hour(s)
Host
Partic.
10