题解 | #合法IP#
合法IP
https://www.nowcoder.com/practice/995b8a548827494699dc38c3e2a54ee9
blocks = input().split(".") def isvalid(): if len(blocks) != 4: return False for block in blocks: if not block or not 0 <= int(block) < 256 or len(block) != len(str(int(block))): return False return True print("YES" if isvalid() else "NO")