import re
result = [0,0,0,0,0,0,0]
d_list = []
def isValidIp(ip_list):
for x in ip_list:
if not x:
return 5,-1
for x in ip_list:
if int(x) > 255:
return 5,-1
if 0 < int(ip_list[0]) < 127:
if int(ip_list[0]) == 10:
return 6,0
return 0,-1
elif 127 < int(ip_list[0]) < 192:
if int(ip_list[0]) == 172 and 15 < int(ip_list[1]) < 32:
return 6,1
return 1,-1
elif 191 < int(ip_list[0]) < 224:
if int(ip_list[0]) == 192 and int(ip_list[1]) == 168:
return 6,2
return 2,-1
elif 223 < int(ip_list[0]) < 240:
return 3,-1
elif 239 < int(ip_list[0]) < 256:
return 4,-1
elif 0 == int(ip_list[0]) or 127 == int(ip_list[0]):
return 7,-1
else:
return 5,-1
def isValidWeb(web_list):
pattern = "^[1]+[0]+$"
web_str = ""
first_index0 = 0
for x in web_list:
if not x:
return 5,-1
for x in web_list:
if int(x) > 255:
return 5,-1
for x in web_list:
y = str(bin(int(x)))[2:].rjust(8,"0")
web_str += y
match_list = re.match(pattern,web_str)
if match_list:
return True
else:
return False
for line in sys.stdin:
if "~" in line:
a,b = line.split("~")
ip_list = a.split(".")
web_list = b.split(".")
web_valid = isValidWeb(web_list)
a,b = isValidIp(ip_list)
if a == 7:
# print("ignore ",line)
pass
elif not web_valid:
# print("web error",line)
result[5] += 1
elif a == -1:
pass
# print("something error", line)
elif a == 6:
result[6] += 1
result[b] += 1
elif a == 5:
result[5] += 1
# print("ip error",line)
else:
result[a] += 1
else:
break
for x in result:
print(x,end=" ")