AlgoUniversity
  • Go Back
Discussion
Check IP :

Author

Akshay Sharma

Difficulty Level : Medium

Submissions : 357

Asked In : Sprinklr

Marks :100

: 0 | : 0

Pairtel company is given the contract to assign Ip addresses to the computers of HackerEarth.The printer used to print the set malfunctioned and some of the addresses were wrongly printed.

Check the validity of each address. Return "IPv4" If IP is a valid Ipv4 Address, "IPv6" If P is a valid IPv6 address or "Invalid" If IP is not a correct IP of any type.

Input

The first line contains a string denoting the IP addresses

Output

For each test print the type of IP address

Example

Input
192.168.0.1
Output
IPv4

Note

A valid IPv4 address is an IP in the form "x1.x2.x3.x4" where ($$$0 \le xi \le 255$$$) and xi cannot contain leading zeros.

A valid IPv6 address is an IP in the form "x1 : x2 : x3 : x4 : x5 : x6 : x7 : x8" where:($$$1 \le i.length \le 4$$$) xi is a hexadecimal string which may contain digits, lower-case English letters ('a' to 'f') and upper-case English letters ('A' to 'F').

Leading zeros are allowed in xi.

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.