Kotlin solution
\nclass Solution {\n    fun ambiguousCoordinates(S: String): List<String> {\n        val content = S.substring(1, S.length - 1)\n        if (content.length <= 1
```\nclass Solution {\n    fun ambiguousCoordinates(S: String): List<String> {\n        val content = S.substring(1, S.length - 1)\n        if (content.length <= 1) return listOf()\n        return (0 until content.length - 1).flatMap {\n            val left = decimals(content.substring(0, it + 1))\n            val right = decimals(content.substring(it + 1))\n            if (left != null && right != null) {\n                left.flatMap { l -> right.map { r -> "($l, $r)"} }\n            } else {\n                emptyList()\n            }\n        }\n    }\n\n    private fun decimals(S: String): List<String>? {\n        if (S[0] == \'0\') {\n            if (S.length == 1) return listOf("0")\n            if (S.all { it == \'0\' }) return null\n            if (S.last() == \'0\') return null\n            return listOf("0.${S.substring(1)}")\n        } else {\n            return if (S.last() == \'0\') listOf(S) else (0 until S.length).map {\n                if (it < S.length - 1) "${S.substring(0, it + 1)}.${S.substring(it + 1)}" else S\n            }\n        }\n    }\n}\n```
[]