题解 | #合法IP#
合法IP
http://www.nowcoder.com/practice/995b8a548827494699dc38c3e2a54ee9
要考虑到各种稀奇古怪的情况
let ip while(ip = readline()){ let arr = ip.split(/[^0-9]/) if(arr.length!==4) { print("NO") }else{ let flag = arr.some(item=>{ if(isNaN(parseInt(item))||parseInt(item)>255||(item.startsWith('0')&&item.length>1)){ return true } }) if(flag) print("NO") else print("YES") } }