Hexadecimal Chaos
Time limit1sMemory limit1024 MB
Given a shortened IPv6 address, expand it to the full notation of 8 groups of 4 hexadecimal digits separated by colons.
- Level
Easy2 of 10
- Topics
- String, Implementation
- Solved
- No attempts yet
Problem
The next generation internet protocol IPv6 defines a -bit IP address. The full notation of an IPv6 address consists of groups of hexadecimal digits, with the groups separated by colons (':'). For example:
2001:0db8:85a3:0000:0000:8a2e:0370:7334
Several simplifications of the full notation are allowed to shorten IPv6 addresses.
-
All or some of the leading zeros within a group can be omitted, so the address above can be shortened as:
2001:db8:85a3:0:00:8a2e:370:7334 -
In addition, one or more consecutive groups of zeros can be replaced with a double colon ("
::"). The address above then becomes:2001:db8:85a3::8a2e:370:7334This simplification can be applied only once, so that the shortened form determines the address uniquely.
Input
The first line contains a string of at most characters, which is a correctly written IPv6 address. The string consists only of the digits '0' to '9', the lowercase letters 'a' to 'f', and colons (':').
Output
Print the full notation of the given IPv6 address on a single line.