Sahil's computer address
Practice
4.1 (26 votes)
Approved
Data structures
Easy
Implementation
Approved
Problem
63% Success 14436 Attempts 20 Points 1s Time Limit 64MB Memory 1024 KB Max Code

Given a String S, you need to report if the given String is a valid IP Address :

A valid IP address is:

  1. It has exactly 4 non-empty parts separated by 3 dots, like: 255 [dot] 255 [dot] 255 [dot] 255
  2. Decimal value of each part of the IP address should never exceed 255 and never be less than zero.

[dot] is written, instead of the .(dot) character for readability.

Input Format :

The first and only line of input contains the string S. The string shall consist of only numbers and .(dot) symbol of ASCII character set only. All IP addresses will be in decimal i.e. base 10 notation only.

Output Format :

Print the "YES" or "NO" answer on a single line.

Constraints :

1≤|S|≤64

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
16 votes
Tags:
EasyImplementationadhoc
Points:20
72 votes
Tags:
EasyMath
Points:20
48 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyHiringImplementation