论"0"开头的杀伤力
import sys
def check_ip_str(s):
if len(s) != 4:
return False
for each in s:
try:
if "+" in each:
return False
if not 0 <= int(each) <= 255:
return False
if each.startswith("0") and int(each) != 0:
return False
except Exception:
return False
return True
for line in sys.stdin:
if "." not in line:
print("NO")
continue
ip_str = line.split(".")
print("YES" if check_ip_str(ip_str) else "NO")



京公网安备 11010502036488号