1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import sys ip = list(sys.stdin.readline().rstrip().split(‘:’)) new_ip = [] new_ip2 = [] flag = 0 for i in range(len(ip)): if ip[i] == ”: flag = 1 continue if flag == 0: new_ip.append(ip[i].zfill(4)) else: new_ip2.append(ip[i].zfill(4)) for _ in range(8 – len(new_ip) – len(new_ip2)): new_ip.append(‘0000’) new_ip += new_ip2 print(‘:’.join(new_ip)) | cs |