题解 | #合法IP#
合法IP
http://www.nowcoder.com/practice/995b8a548827494699dc38c3e2a54ee9
def ip(string): if len(string) != 4: return 0 for s in string : if len(s) > 1 and int(s[0]) == 0: return 0 List = list(map(int,string)) for i in List: if i < 0 or i > 255: return 0 return 1 if name == "main": try: string = input().strip().split(".") print("YES" if ip(string) else "NO") except: print("NO")