swift solution with explanation
\nclass Solution {\n    func ambiguousCoordinates(_ s: String) -> [String] {\n        var str = Array(s)\n        str.removeFirst()\n        str.removeLast()\n 
```\nclass Solution {\n    func ambiguousCoordinates(_ s: String) -> [String] {\n        var str = Array(s)\n        str.removeFirst()\n        str.removeLast()\n        var ans: [String] = []\n        var lefts: [String] = []\n        var rights: [String] = []\n        for i in 0..<str.count-1 {\n            lefts = makeStrings(str, 0, i)\n            rights = makeStrings(str, i+1, str.count-1)\n            for left in lefts {\n                for right in rights {\n                    let temp = "(" + left + ", " + right + ")"\n                    ans.append(temp)\n                }\n            }\n        }\n        return ans\n    }\n\n    func makeStrings(_ s: [Character], _ i: Int, _ j: Int) -> [String] {\n        var str = s[i...j]\n        var result: [String] = []\n        for idx in i...j { // Array.Slice is only a view of an original arran, so we use original index rather than 0..<str.count, which will cause index out of bounds error\n            var left: [Character] = []\n            var right: [Character] = []\n            \n            if idx == j { // reach the last index, do not need to split\n                left.append(contentsOf: Array(str[i...j]))\n                right = []\n            } else {\n                left = Array(str[i...idx])\n                right = Array(str[idx+1...j])\n            }\n            if !(left.count > 1 && left.first! == "0") { // case like left =  "01" right = "23" we do not add dot\n                if right.isEmpty {\n                    result.append(String(left))\n                } else {\n                    var temp = left\n                    temp.append(".")\n                    temp.append(contentsOf: right)\n                    if temp.last! != "0" { // case like "1.0" is not eligible\n                        result.append(String(temp))\n                    }\n                    \n                }\n            }\n        }\n        return result\n    }\n}\n\n```
['Swift']