[Accepted] Swift
\nclass Solution {\n    func ambiguousCoordinates(_ s: String) -> [String] {\n\n        func lr(_ s: String) -> [(String, String)] {\n            (1..<s.count).
```\nclass Solution {\n    func ambiguousCoordinates(_ s: String) -> [String] {\n\n        func lr(_ s: String) -> [(String, String)] {\n            (1..<s.count).map { (String(s.prefix($0)), String(s.dropFirst($0))) }\n        }\n\n        func opts(_ s: String) -> [String] {\n            guard !s.hasPrefix("00") || s.contains(where: { $0 != "0" }) else { return [] }\n            guard !s.hasPrefix("0") || !s.hasSuffix("0") || s == "0" else { return [] }\n            guard s.count > 1, !s.hasSuffix("0") else { return [s] }\n            guard !s.hasPrefix("0") else { return ["\\(0).\\(s.dropFirst())"] }\n            return [s] + lr(s).map { "\\($0).\\($1)" }\n        }\n        \n        return lr(String(s.dropFirst().dropLast()))\n            .map { (opts($0), opts($1)) }\n            .filter { !$0.isEmpty && !$1.isEmpty }\n            .flatMap { ls, rs in ls.flatMap { l in rs.map { r in "(\\(l), \\(r))" } } }\n    }\n}\n```
['Swift']