动态规划
let str;
while ((str = readline())) {
let text1 = str;
let text2 = readline();
const m = text1.length,
n = text2.length;
let max = 0;
const dp = new Array(m + 1).fill(0).map(() => new Array(n + 1).fill(0));
for (let i = 1; i <= m; i++) {
for (let j = 1; j <= n; j++) {
if (text1[i - 1] === text2[j - 1]) {
dp[i][j] = dp[i - 1][j - 1] + 1;
} else {
dp[i][j] = 0;
}
max = max < dp[i][j] ? dp[i][j] : max;
}
}
print(max);
}