题解 | #在字符串中找出连续最长的数字串#

在字符串中找出连续最长的数字串

http://www.nowcoder.com/practice/2c81f88ecd5a4cc395b5308a99afbbec

let str;
while(str = readline()){
  let res = str.match(/\d+/g);
  let max = 0;
  for(let v of res){
    if(v.length>max){
      max = v.length;
    }
  }
  let resStr = ''
  for(let v of res){
    if(v.length == max){
      resStr +=v
    }
  }
  console.log(resStr+','+max)
}
全部评论

相关推荐

ZywOo_求职版:谁问你了....
投递字节跳动等公司9个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务