Its the subject Computer Networks and Cibin is confused between Ipv4 and Ipv6 addresses. His teacher solved his doubts and taught him about both.
Following were the points his teacher covered about Ipv4 addresses:
• An IPv4 address has the following format: x . x . x . x where x is called an octet and must be a decimal value between 0 and 255. Octets are separated by periods. An IPv4 address must contain three periods and four octets.
• No period should start with 0 unless the period has single digit.
• The following examples are valid Ipv4 Addresses:
Following were the points his teacher covered about Ipv6 addresses:
• In IPv6, addresses are expressed as a series of eight 4-character hexadecimal numbers, which represent 16 bits each (for a total of 128 bits).
• Leading zeroes MUST be suppressed. For example, 1:08:1:2:3:01:ab:5 is not acceptable and must be represented as 1:8:1:2:3:1:ab:5
• The characters "a", "b", "c", "d", "e", and "f" in an IPv6 address MUST be represented in lowercase.
• The following examples are valid Ipv6 Addresses:
Now, his teacher wants to check how much Cibin learnt from his efforts by taking a short assessment test.
The first line of input contain an integer T denoting the number of test cases. Each test case consists of one line, which contains a string of address.
For each test case, output a single line output as ipv4 / ipv6 / invalid.
1 <= T <= 100
In test case 1, the address is a valid IPv4 address.
In test case 2, capital letters are used and 0 is not suppressed which makes it invalid IPv6 address.
In test case 3, the address is a valid IPv6 address.
In test case 4, the address is not a valid IPv4 address due to the usage of alphabets.