#K8966. IPv4 Address Validation
IPv4 Address Validation
IPv4 Address Validation
Given an IPv4 address in the form A.B.C.D, where A, B, C, and D are integers, determine whether the address is valid. An IPv4 address is considered valid if and only if:
- It consists of exactly four parts separated by a dot.
- Each part is a non-negative integer that satisfies the inequality $$0 \leq x \leq 255$$.
- Leading zeros are allowed (for example,
192.168.0.01
is valid).
For each test case, output Valid
if the IPv4 address meets these conditions; otherwise, output Invalid
.
inputFormat
The input is read from stdin and has the following format:
- The first line contains an integer
T
denoting the number of test cases. - Each of the following
T
lines contains a single string representing an IPv4 address.
outputFormat
For each test case, print a single line to stdout containing either Valid
or Invalid
depending on whether the provided IPv4 address is valid.
3
192.168.0.1
255.255.255.255
256.100.100.100
Valid
Valid
Invalid
</p>