a = b = c = d = e = wrongIP = privateIP = 0 import re def bins(strs): results = "" strs = strs.split(".") for i in strs: b = str(bin(int(i)))[2:] if len(b) < 8: results += (8-len(b))*"0"+b else: results += b return results def wrongIPs(macs): if macs[0] == "0": return 1 if macs.count("1") == 32: return 1 num_1 = macs.count("1") if macs == num_1*"1" + (32-num_1)*"0": return 0 else: return 1 def privateIPs(ips): ips = ips.split(".") ips_0 = ips[0] ips_1 = ips[1] ips_2 = ips[2] ips_3 = ips[3] if int(ips_1) <= 255 and int(ips_2) <= 255 and int(ips_3) <= 255: if ips_0 == "10": return 1 if ips_0 == "172" and 16<=int(ips_1)<=31: return 1 if ips_0 == "192" and ips_1 == "168": return 1 else: return 0 try: while True: inpt = str(input()) ips = inpt.split("~") if re.findall(r"^\d+.\d+.\d+.\d+$", ips[0]) and re.findall(r"^\d+.\d+.\d+.\d+$", ips[1]): if wrongIPs(bins(ips[1])): wrongIP += wrongIPs(bins(ips[1])) else: if privateIPs(ips[0]): privateIP += privateIPs(ips[0]) ips_0 = ips[0].split(".") if int(ips_0[1]) <= 255 and int(ips_0[2]) <= 255 and int(ips_0[3]) <= 255: if 1 <= int(ips_0[0]) <= 126: a += 1 if 128 <= int(ips_0[0]) <= 191: b += 1 if 192 <= int(ips_0[0]) <= 223: c += 1 if 224 <= int(ips_0[0]) <= 239: d += 1 if 240 <= int(ips_0[0]) <= 255: e += 1 else: wrongIP += 1 else: wrongIP += 1 except: print(a, b, c, d, e, wrongIP, privateIP)