BETA

Difficulty Level: Easy

Submissions: 1805 Accuracy:

28.14%

Validate an IP Address (Function Problem)
     

Write a program to Validate an IPv4 Address. Your task is  to complete the function isValid which returns 1 if the ip address is valid else returns 0. The function takes a string ip as its only argument .

Input:
The first line of each test case contains an integer T denoting the number of test case . Then T test cases follow . Each test case takes a string ip.

Output:
For each test case output will be 1 if the string is a valid ip address else 0.

Constraints:
1<=T<=50
1<=length of string <=50

Example(To be used only for expected output) :
Input

2
222.111.111.111
5555..555

Output
1
0


Note:The Input/Ouput format and Example given are used for system's internal purpose, and should be used by a user for Expected Output only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Harshit Sidhwa


					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.