题解 | #在字符串中找出连续最长的数字串#
在字符串中找出连续最长的数字串
https://www.nowcoder.com/practice/2c81f88ecd5a4cc395b5308a99afbbec
const rl = require("readline").createInterface({ input: process.stdin }); var iter = rl[Symbol.asyncIterator](); const readline = async () => (await iter.next()).value; void async function () { // Write your code here while(line = await readline()){ let map = []; line.replace(/\d+/g,(res)=>{ if(map[res.length]){ map[res.length].push(res) }else { map[res.length] = [res] } }) console.log(map[map.length-1].reduce((acc,item)=>(acc+item),"") + "," + (map.length-1)) } }()