[Python] Solution + explanation
We can split this problem into two subproblems:\n1. Get all the possible values for coordinates substring (102 -> [1.02, 10.2, 102], 00 -> [])\n2. Get all the p
We can split this problem into two subproblems:\n1. Get all the possible values for coordinates substring (`102` -> `[1.02, 10.2, 102]`, `00` -> `[]`)\n2. Get all the possible combinations for two coordinates substrings\n\nFor the first subproblem, refer to `variants` function. It should be self-explanatory: we iterate through coordinate substring and split it into whole part and fractional part. Then we validate each part according to problem description. If both parts are valid, we add it to our answer.\n\nFor the second subproblem we iterate through input string, split it into two parts, call `variants` function and use `itertools.product` to generate all the possible combinations.\n\n# Code\n```\nclass Solution:\n    def ambiguousCoordinates(self, s: str) -> List[str]:\n        s = s[1:len(s) - 1]\n\n        @functools.cache\n        def variants(val):\n            vals = []\n\n            for i in range(1, len(val) + 1):\n                whole = val[:i]\n                fractional = val[i:]\n\n                if whole[0] == "0" and len(whole) > 1:\n                    continue\n\n                if fractional:\n                    if fractional[-1] == "0":\n                        continue\n\n                    vals.append(f"{whole}.{fractional}")\n                else:\n                    vals.append(whole)    \n\n            return vals\n\n        result = []\n\n        for i in range(1, len(s)):\n            result.extend(\n                f"({a}, {b})" \n                for a, b in itertools.product(variants(s[:i]), variants(s[i:]))\n            )\n\n        return result\n        \n```
['Python3']