题解 | #在字符串中找出连续最长的数字串#
在字符串中找出连续最长的数字串
https://www.nowcoder.com/practice/2c81f88ecd5a4cc395b5308a99afbbec
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
rl.on("line", function (line) {
let re = /\d+/g
let list = line.match(re)
let oldList = line.match(re)
//降序
list.sort((a,b)=>{
return parseInt(b) -parseInt(a)
})
let maxLength = list[0].length
let maxStr =[]
oldList.forEach(c=>{
if(c.length == maxLength){
maxStr.push(c)
}
})
console.log(maxStr.join("")+","+maxLength)
});