import java.util.*;
/**
* HJ75 公共子串计算 - 中等
*/
public class HJ075 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
String str1 = sc.next();
String str2 = sc.next();
String shortStr = str1.length() <= str2.length() ? str1 : str2;
String longStr = str1.length() > str2.length() ? str1 : str2;
int maxLength = maxLength(shortStr, longStr);
System.out.println(maxLength);
}
sc.close();
}
// TODO: 2022/11/15 最大公共子串
private static int maxLength(String shortStr, String longStr) {
for (int i = 0; i < shortStr.length(); i++) {
for (int j = 0; j < i + 1; j++) {
String substr = shortStr.substring(j, shortStr.length() - i + j);
if (longStr.contains(substr)) {
return substr.length();
}
}
}
return 0;
}
}