BETA

Difficulty Level:

Medium

Total Submissions: 1500 Accuracy:

19.8%

Generate IP Addresses (Function Problem)
       

Given a string s containing only digits, Your task is to complete the function genIp which returns a vector containing all possible combination of valid IPv4 ip address and takes only a string s as its only argument . 
Note : Order doesn't matter

For string 11211 the ip address possible are 
1.1.2.11
1.1.21.1
1.12.1.1
11.2.1.1

Input:
The first line of input will contain no of test cases T. Then T test cases follow . Each test case will contains a string s . 

Output:
The output in the expected output will be 1 if successfully all the combinations were obtained in the returned vector else it will be 0.

Constraints:
1<=T<=100
1<=str<=16

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

1
1111

Output
1


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.