题解 | #合法IP#
合法IP
https://www.nowcoder.com/practice/995b8a548827494699dc38c3e2a54ee9
while True:
try:
ip_lst = list(input().split("."))
a = 0
for i in ip_lst:
if i.isdigit() and 0 <= int(i) <= 255 and len(str(i)) == len(str(int(i))):
a += 1
if a == 4:
print("YES")
else:
print("NO")
except:
break
查看7道真题和解析