import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); char[]c1=sc.next().toCharArray(); char[]c2=sc.next().toCharArray(); int[][]c=new int[c1.length+1][c2.length+1]; int max=0; for (int i =1; i < c.length; i++) { for (int j = 1; j < c[i].length; j++) { if(c1[i-1]==c2[j-1]) c[i][j]=c[i-1][j-1]+1; else c[i][j]=Math.max(c[i-1][j],c[i][j-1]); if(c[i][j]>max)max=c[i][j]; } } System.out.println(max); } }
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题10.5 (C语言代码)浏览:565 |
哥德巴赫曾猜测 (C语言代码)浏览:1136 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:947 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:698 |
A+B for Input-Output Practice (VI) (C语言代码)浏览:575 |
C二级辅导-等差数列 (C语言代码)浏览:885 |
C语言训练-自守数问题 (C语言代码)浏览:791 |
C语言程序设计教程(第三版)课后习题9.3 (C语言代码)浏览:629 |
【出圈】 (C++代码)简单循环浏览:696 |
简单的a+b (C语言代码)浏览:587 |