题解 | #合法IP#
合法IP
http://www.nowcoder.com/practice/995b8a548827494699dc38c3e2a54ee9
# -*-coding:utf-8-*-
import math , string
while True:
try:
ip_str = input().split(".")
if len(ip_str) == 4 :
for ip in ip_str:
if not ip.isalnum():
print("NO")
break
if int(ip) not in range(0,256):
print("NO")
break
if len(ip)>1 and ip[0] == '0':
print("NO")
break
else:
print("YES")
else:
print("NO")
except:
break