#include<iostream>
#include<cstring>
using namespace std;
const int maxn=100;
char str1[maxn];
char str2[maxn];
int dp[maxn][maxn];
int main(){
while(cin>>str1+1>>str2+1){
int m=strlen(str1+1);
int n=strlen(str2+1);
for(int i=0;i<=m;i++){
for(int j=0;j<=n;j++){
if(i==0||j==0){
dp[i][j]=0;
continue;
}
if(str1[i]==str2[j]){
dp[i][j]=dp[i-1][j-1]+1;
}
else{
dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
}
}
}
cout<<dp[m][n]<<endl;
}
}

京公网安备 11010502036488号