Concise C++ solution with comments
\nvector<string> cases(string &&s) {\n    if (s.size() == 1) // single digit\n        return {s};\n    if (s.front() == \'0\') { // 0xxx\n        if (s.back() =
```\nvector<string> cases(string &&s) {\n    if (s.size() == 1) // single digit\n        return {s};\n    if (s.front() == \'0\') { // 0xxx\n        if (s.back() == \'0\') // 0xxx0\n            return {};\n        return {"0." + s.substr(1)}; // 0xxx9\n    }\n    if (s.back() == \'0\') // 9xxx0\n        return {s};\n    vector<string> res{s}; // 9xxx9\n    for (int i = 1; i < s.size(); i++)\n        res.emplace_back(s.substr(0, i) + "." + s.substr(i));\n    return res;\n}\n\nvector<string> ambiguousCoordinates(string S) {\n    vector<string> res;\n    for (int i = 2; i < S.size() - 1; i++) // position of comma\n    for (auto &x : cases(S.substr(1, i - 1)))\n    for (auto &y : cases(S.substr(i, S.size() - i - 1)))\n        res.emplace_back("(" + x + ", " + y + ")");\n    return res;\n}\n```
[]