import sys
#十进制转二进制bin(),二进制转十进制int(x,2)
a=input()
if a.count(".")!=3:
print("NO")
sys.exit()
else:
a=a.split(".")
if a.count("")>0:
print("NO")
sys.exit()
if len(a)!=4:
print("NO")
sys.exit()
else:
for i in range(len(a)-1):
if not a[i].isdigit() and len(a[i]) > 1:
print("NO")
sys.exit()
if a[i].startswith('0') and len(a[i]) > 1:
print("NO")
sys.exit()
y=int(a[i])
if y<0 or y>255:
print("NO")
sys.exit()
y=a[3]
if len(y) > 1 and not y[0].isdigit():
print("NO")
sys.exit()
if len(y) > 1 and y[0]=='0':
print("NO")
sys.exit()
if int(y)>=0 and int(y)<=255:
print('YES')
startswith() 看着题解做的,学到了startswith('0')这个函数