#C8219. IP Address Validator

    ID: 52177 Type: Default 1000ms 256MiB

IP Address Validator

IP Address Validator

In this problem, you are given a string representing an IPv4 address and must determine if it is a valid IP address. An IP address is valid if and only if it satisfies the following conditions:

  1. It consists of exactly four groups of digits separated by dots (i.e., in the format x.x.x.x).
  2. Each group represents an integer in the range (0 \leq x \leq 255).
  3. No group contains leading zeros unless the group is exactly "0".

For example, the IP address "192.168.1.1" is valid, while "256.100.50.0" or "1.1.1.01" are invalid because the first one contains a number greater than 255 and the second one has a group with a leading zero.

Your program should read from standard input and output the result to standard output.

inputFormat

A single line containing the IP address string to be validated.

outputFormat

A single line; either 'Valid' if the IP address is valid according to the rules, or 'Invalid' if it is not.## sample

192.168.1.1
Valid