C++ Solution with some comments
\nclass Solution {\npublic:\n    vector<string> ambiguousCoordinates(string S) {\n        // First get rid of paranthesis at the both end\n        S.erase(0, 1)
```\nclass Solution {\npublic:\n    vector<string> ambiguousCoordinates(string S) {\n        // First get rid of paranthesis at the both end\n        S.erase(0, 1);\n        S.pop_back();\n        vector<string> result;\n        vector<pair<string, string>> valids;\n        int size = S.size();\n        // Without dots\n        for (int i = 0; i < size - 1; i++) {\n            string A = S.substr(0, i + 1);\n            string B = S.substr(i + 1, size - i + 1);\n            valids.push_back({A, B});\n        }\n        // With Dots\n        for (int i = 0; i < valids.size(); i++) {\n            vector<string> left = { valids[i].first }, right = { valids[i].second };\n            if (valids[i].first.size() > 1) {\n                for (int j = 1; j < valids[i].first.size(); j++) {\n                    string withDotL = valids[i].first;\n                    withDotL.insert(j, 1, \'.\');\n                    left.push_back(withDotL);\n                }\n            }\n            if (valids[i].second.size() > 1) {\n                for (int j = 1; j < valids[i].second.size(); j++) {\n                    string withDotR = valids[i].second;\n                    withDotR.insert(j, 1, \'.\');\n                    right.push_back(withDotR);\n                }\n            }\n            // Start checking validity\n            for (int i = 0; i < left.size(); i++) {\n                for (int j = 0; j < right.size(); j++) {\n                    if (isValid(left[i]) && isValid(right[j])) {\n                        result.push_back("(" + left[i] + ", " + right[j] + ")");\n                    }\n                }\n            }\n        }\n        return result;\n    }\n    \n    // Valid 0, 0.X\n    // Invalid: "5.0", "00", "0.0", "0.00", "1.0", "001", "00.01"\n    bool isValid(string &s) {\n        // Single char\n        if (s.size() == 1) {\n            return true;\n        }\n        // Invalid case: 0xxx0\n        if (s[0] == \'0\') {\n            // Only valid 0.xxx\n            if (s[1] != \'.\') {\n                return false;\n            }\n            // 00, 0xx0\n            if (s.back() == \'0\' || s[1] == \'0\') {\n                return false;\n            }\n            return true;\n        }\n        // Invalid case: xxx.0\n        if (s.back() == \'0\') {\n            // Only valid case xxx0\n            if (s.find(\'.\') == std::string::npos) {\n                return true;\n            }\n            return false;\n        }\n        return true;\n    }\n};\n```
['C']