Given a digit string, return all possible IP Addresses that can be formed from the string.
A valid IP Address contains four integers each in the range of [0, 255]. The four numbers are separated by a '.'. The integers do not have any leading zeros unless the number is itself 0.
str: "25525511135"
IP: [
"255.255.11.135",
"255.255.111.35"
]
str: "8888"
IP: [
"8.8.8.8"
]
str: "0000"
IP: [
"0.0.0.0"
]
str: "002500"
IP: [
"0.0.250.0"
]
The resultant list should be sorted lexicographically. Consider that '.' < '0'.
The first line contains an integer ‘T’, denoting the number of test cases.
For each test case, the input has string str.
For each test case, the output has the following lines:
4
25525511135
8888
0000
002500
2
255.255.11.135 255.255.111.35
1
8.8.8.8
1
0.0.0.0
1
0.0.250.0
1 <= T <= 1000
1 <= n <= 12