LogiQuest

340. Validate an IPv4 Address

MediumParsingValidation

Print VALID if the string is a valid IPv4 address (four decimal numbers 0–255 separated by dots, no leading zeros except the number 0 itself), else INVALID.

Input format

A single line.

Output format

VALID or INVALID

Example 1

Input

192.168.1.1

Output

VALID

Example 2

Input

256.1.1.1

Output

INVALID

Constraints

1 ≤ length ≤ 50

Read input from standard input and print the answer to standard output. Your code is judged against 7 test cases, most of them hidden.

Loading the MyLoginn IDE…