同:ZJU 1733,HDU 1159
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std; int dp[][];
int main()
{
char a[], b[];
int la, lb;
while(scanf("%s%s", a, b) != EOF)
{
memset(dp, , sizeof(dp));
la = strlen(a), lb = strlen(b);
for(int i = ; i < la; i++)
{
for(int j = ; j < lb; j++)
{
if(a[i] == b[j])
{
dp[i+][j+] = dp[i][j] + ;
}
else
{
dp[i+][j+] = max(dp[i+][j], dp[i][j+]);
}
}
}
printf("%d\n", dp[la][lb]);
}
return ;
}