while(str1 = readline(), str2 = readline() ) {
let str1Len = str1.length;
let str2Len = str2.length;
let len;
let str;
let strM;
if (str1Len > str2Len) {
len = str2Len;
str = str2;
strM = str1;
} else {
len = str1Len;
str = str1;
strM = str2;
}
let sliceStr = '';
let sliceLen = 0;
let maxCount = 0;
for (let i = 0; i < len; i++) {
for (let j = i+1; j < len + 1; j++) {
sliceStr = str.slice(i,j);
sliceLen = str.slice(i,j).length;
if (strM.indexOf(sliceStr) > -1) {
maxCount = Math.max(maxCount, sliceLen);
}
}
}
console.log(maxCount);
}
#算法学习#