Rearrange IP Adress

Problem


Given a string containing only digits, restore it by returning all possible valid IP address combinations.

Example


Given "25525522235",

return ["255.255.222.35", "255.255.22.235"]. (Order must be 3 digits first and then 2 or 1 digit. For example ["255.255.222.35", "255.255.22.235"] )

Contributed by Erkan Ercan