insidcode
ProblemsDuelLeaderboardStats
Sign In
  1. Home
  2. Problems
  3. Validate an IPv4 address format (four integers separated by dots, each 0–255 with no leading zeros).

Validate an IPv4 address format (four integers separated by dots, each 0–255 with no leading zeros).

Difficulty: Medium

Phase: 6 · Mixed Logical Challenges

XP Reward: 20 XP

Topics: Mixed Logical Challenges, Medium

Supported Languages: Python, JavaScript, C, C++, Java

Problem Description

Validate IPv4 address format strictly (4 octets 0-255 with no leading zeros). Print 'Valid' or 'Invalid'. Input Format: Read input from standard input (stdin). Output Format: Print the result to standard output (stdout).

Constraints

  • -10^9 <= N <= 10^9

Examples

Example 1

Input: 172.16.254.1

Output: Valid

Explanation: Sample execution for input 172.16.254.1