import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
}
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String x=sc.next();
String y=sc.next();
int[][] dp=new int[x.length()+1][y.length()+1];
for (int i = 0; i < x.length(); i++) {
for (int j = 0; j <y.length(); j++) {
if(x.charAt(i)==y.charAt(j)) {
dp[i+1][j+1]=dp[i][j]+1;
}else {
dp[i+1][j+1]=Math.max(dp[i][j+1],dp[i+1][j]);
}
}
}
System.out.println(dp[x.length()][y.length()]);
}}
0 回复
0 转发
0 喜欢
1 阅读



