const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); let inputArr = [];//存放输入的数据 rl.on('line', function(line){ inputArr.push(line); }).on('close', function(){ console.log(maxString(inputArr[0], inputArr[1]))//调用函数并输出 }) function maxString(a, b) { if (a.length < b.length) { [a, b] = [b, a]; } let res = ''; for(let l = 0; l < b.length; l++) { for (let r = l + 1; r <= b.length; r++) { if(r - l > res.length && a.indexOf(b.slice(l, r)) !== -1) { res = b.slice(l, r); } } } return res; }