Fast, Simple, Easy to understand, C++
Intuition\n Describe your first thoughts on how to solve this problem. \nThe problem requires generating all possible ambiguous coordinates from a given string 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe problem requires generating all possible ambiguous coordinates from a given string representing a number. Ambiguous coordinates are those that can be interpreted in multiple ways by adding a decimal point at different positions. For example, "123" can be interpreted as "(1, 23)", "(12, 3)", or "(1.2, 3)".\n\nI use this free website to learn C++\nhttps://cppexpert.online/\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nWe iterate over all possible splits of the input string s into two parts: left and right substrings.\nFor each split, we generate all possible decimal representations for the left and right substrings separately using the populate function.\nWe combine the generated left and right representations to form ambiguous coordinates and add them to the result vector.\nThe populate function generates all possible decimal representations for a given input string.\nIf the input starts with \'0\', it adds the input string itself to the output vector if it has only one digit or adds a decimal representation with the leading zero removed.\nIf the input does not start with \'0\', it adds the input string itself to the output vector and then inserts a decimal point at every position in the string except for the last digit.\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nn^2\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nn^2\n# Code\n```\nclass Solution {\npublic:\n\n    void populate(const string & in, vector<string>& out) {\n            int size_in = in.size();\n            if (in.front() == \'0\') {\n                if (size_in == 1) {\n                    out.push_back(in);\n                } else {\n                    if (in.back() == \'0\') {\n                        // invalid\n                    } else {\n                        auto rest = in.substr(1);\n                        string res = "0.";\n                        out.push_back(res + rest);\n                    }\n                }\n            } else {\n                out.push_back(in);\n                if (in.back() == \'0\') {\n                    // invalid\n                } else {\n                    for (int j = 1; j < size_in; j++) {\n                        string copy_in = in;\n                        copy_in.insert(j, 1, \'.\');\n                        out.push_back(copy_in);\n                    }\n                }\n            }\n    }\n\n    vector<string> ambiguousCoordinates(string s) {\n        int num_digits = s.size() - 2;\n        vector<string> result;\n\n        for (int i = 1; i < num_digits; i++) {\n            vector<string> lefts;\n            vector<string> rights;\n            string left = s.substr(1, i);\n            string right = s.substr(i + 1, num_digits - i);\n            populate(left, lefts);\n            populate(right, rights);               \n            for (const auto & l : lefts) {\n                string formatted_l = "(";\n                formatted_l += l;\n                formatted_l += ", ";\n                for (const auto & r : rights) {\n                    auto formatted_r = r;\n                    formatted_r.push_back(\')\');\n                    result.push_back(formatted_l + formatted_r);\n                }\n            }\n        }\n        return result;\n        \n    }\n};\n```
['C++']