抄袭大佬
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
String str1 = sc.nextLine();
String str2 = sc.nextLine();
if (str1.length() > str2.length()) {
String temp = str1;
str1 = str2;
str2 = temp;
}
int maxSize = 0;
for (int i = 0; i < str1.length(); i++) {
for (int j = str1.length(); j > i; j--) {
if (str2.contains(str1.substring(i, j))) {
maxSize = Math.max(maxSize, j - i);
}
}
}
System.out.println(maxSize);
}
sc.close();
}
}