import java.util.Scanner;
public class Main {
public static void fun(String str1, String str2){
if(str1==null || str2== null || str1.length()==0 || str2.length()==0){
return;
}
int len1 = str1.length();
int len2 = str2.length();
char[] ch1 = str1.toCharArray();
char[] ch2 = str2.toCharArray();
String res = "";
for(int i=0; i<len1; i++){
String temp = "";
int index = i;
for(int j=0; j<len2; j++){
if(index<len1 && ch1[index] == ch2[j]){
index++;
temp += ch2[j];
}else{
if(temp.length()>res.length()){
res = temp;
}
index = i;
temp = "";
}
}
if(temp.length()>res.length()){
res = temp;
}
}
System.out.println(res.length());
}
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
while(input.hasNext()){
String str1 = input.nextLine();
String str2 = input.nextLine();
fun(str1, str2);
}
}
}
输入:aabbaaaa
输出:4 aaaa