Problem
A valid IPv4 address is exactly four numbers separated by dots, where each number is between 0 and 255 and has no leading zeros (0 is fine, 01 is not).
Given a string s of digits, insert three dots to form valid addresses. You may not reorder or drop digits. Return every valid address, in any order.
Example 1
- Input
- "25525511135"
- Output
- ["255.255.11.135", "255.255.111.35"]
Example 2
- Input
- "0000"
- Output
- ["0.0.0.0"]
Example 3
- Input
- "101023"
- Output
- ["1.0.10.23", "1.0.102.3", "10.1.0.23", "10.10.2.3", "101.0.2.3"]
Constraints
1 <= s.length <= 20s contains only digits.