Task DescriptionDiscussion (0)
Input
25:09:1985:aa:091:4846:374:bb
Output
0025:0009:1985:00aa:0091:4846:0374:00bb
Task :: IPv6
In IPv6, the next generation of the Internet protocol, an IP address is 128 bits long. The full text representation of an IPv6 address consists of 8 groups of 4 hexadecimal digits each, where groups are separated by colon characters ':'. For example: 2001:0db8:85a3:0000:0000:8a2e:0370:7334
To compress this textual representation, we are allowed the following transformations:
• All or some leading zeroes in a group can be removed. For example, the above address can be simplified as: 2001:db8:85a3:0:00:8a2e:370:7334
• Additionally, one or more consecutive groups of zeroes can be replaced by adouble colon "::". The above address becomes: 2001:db8:85a3::8a2e:370:7334 This last simplification can be done only once so that the resulting text representation is never ambiguous. Write a program that takes a valid(possibly compressed) text representation of an IPv6 address and outputs its full text representation.
To compress this textual representation, we are allowed the following transformations:
• All or some leading zeroes in a group can be removed. For example, the above address can be simplified as: 2001:db8:85a3:0:00:8a2e:370:7334
• Additionally, one or more consecutive groups of zeroes can be replaced by adouble colon "::". The above address becomes: 2001:db8:85a3::8a2e:370:7334 This last simplification can be done only once so that the resulting text representation is never ambiguous. Write a program that takes a valid(possibly compressed) text representation of an IPv6 address and outputs its full text representation.
INPUT:
The first line contains a string of at most 39 characters, a valid text representation of an IPv6 address. The string consists of digits '0'.'9', lowercase letters 'a'.'f' and colon characters ':'.
The first line contains a string of at most 39 characters, a valid text representation of an IPv6 address. The string consists of digits '0'.'9', lowercase letters 'a'.'f' and colon characters ':'.
OUTPUT:
Output the full representation of the given IPv6 address.
Output the full representation of the given IPv6 address.
Input
25:09:1985:aa:091:4846:374:bb
Output
0025:0009:1985:00aa:0091:4846:0374:00bb
Submit Solution
Available Languages
Task info
Task Ratings
| Difficulty: | 4.6 (10 votes) |
| Quality: | 4.6 (9 votes) |
Acceptance Rate
Recent Submissions
Fastest Solutions
| User | Time |
|---|---|
| FilipKeri | 0 s. |
| smiljko | 0 s. |
| RobertGerbicz | 0 s. |
| DuXSerbia | 0 s. |
| Al3kSaNdaR | 0 s. |
| Dgleich | 0 s. |
| Amtrix | 0 s. |
| fizaaaa | 0 s. |
| halil | 0 s. |
| crusader | 0 s. |
Solved By
Home
Training
Competitions
Forum
FAQ