Easiest Solution
\n\n# Code\njava []\n// the constraints are really small so we can use brute force , rest of the code is self explanatory\n\nclass Solution {\n    public List<S
\n\n# Code\n```java []\n// the constraints are really small so we can use brute force , rest of the code is self explanatory\n\nclass Solution {\n    public List<String> ambiguousCoordinates(String s) {\n        String str = s.substring(1,s.length()-1); // remove brackets from the expression to make it easier to process \n        List<String> list = new ArrayList();\n        for(int i =0;i<str.length()-1;i++){\n            String s1 = str.substring(0,i+1); // first coordinate \n            String s2 = str.substring(i+1);   // second coordinate \n            if(isValid(s1)&&isValid(s2)){ // if both are valid numbers , then we will add this to our result \n                String ans = "("+s1+", "+s2+")";\n                list.add(ans);\n            }\n            // now we form two lists l1 and l2 , l1 consists of all possible decimal numbers that can be formed from s1 , l2 consists of all possible decimal numbers that can be formed from s2 \n            List<String> l1 = new ArrayList();\n            List<String> l2 = new ArrayList();\n            fillList(s1,l1);\n            fillList(s2,l2);\n            for(String ss1 : l1){\n                for(String ss2 : l2){\n                     String ans = "("+ss1+", "+ss2+")"; // adding all (decimal , decimal) pairs to answer\n                     list.add(ans);\n                }\n            }\n            if(isValid(s1)){ // add all (integer , decimal) pairs to answer if s1 is a valid integer\n                for(String ss2 : l2){\n                     String ans = "("+s1+", "+ss2+")";\n                     list.add(ans);\n                }\n            }\n            if(isValid(s2)){ // add all (decimal , integer) pairs to answer if s2 is a valid integer \n                for(String ss1 : l1){\n                     String ans = "("+ss1+", "+s2+")";\n                     list.add(ans);\n                }\n            }\n            \n   }\n        return list;\n    }\n    public boolean isValid(String s){ // this is used to check if an integer is valid and it is also used to check if part of number before decimal is valid \n        if(s.length()==1) return true; // always valid \n        return s.charAt(0)==\'0\'?false:true; // form : 0000....... invalid \n    }\n    public boolean isSecondValid(String s){ // this is used to check if part of number after decimal is valid \n        boolean found = false; // found == true if >=\'1\' found \n        for(int i = 0;i<s.length();i++){\n            char ch = s.charAt(i);\n            if(ch>=\'1\') found = true;\n            else{\n                if(found){ // if >=\'1\' found check if after this do we have only zeroes , because 0.5000000 is invalid \n                    boolean allZeroes = true;\n                    for(int j = i+1;j<s.length();j++){\n                        if(s.charAt(j)>=\'1\') allZeroes = false;\n                    }\n                    if(allZeroes) return false;\n                }\n            }\n        }\n        return found; // found becomes true when >=\'1\' is found so if we have something like 0.0000000 its invalid and we return false in that case \n    }\n \n    public void fillList(String s , List<String> list){ // fills list with all decimal numbers possible from given string s\n            for(int i = 0;i<s.length()-1;i++){\n             String s1 = s.substring(0,i+1);\n             String s2 = s.substring(i+1);\n             if(isValid(s1)&&isSecondValid(s2)){\n                 String ans = s1+"."+s2;\n                 list.add(ans);\n             }\n            }\n    }\n}\n```\n```c++ []\nclass Solution {\npublic:\n    \n    bool valid(string t) { // is this coord valid? \n        int i=1,n=t.size();\n        if(n>=2 and t[0]==\'0\' and t[1]!=\'.\') // 01, 03... --> not valid\n            return false;\n        \n        while(i<n and t[i]!=\'.\') // get position of the point\n              i++;\n        if(i!=n and t[n-1]==\'0\') // 234.0, 931.424320 --> not valid\n            return false;\n        i++;\n        while(i<n and t[i]==\'0\') // if after the point are all zeros, not valid\n            i++;\n        if(i==n) return false;\n        \n        return true; // if here, coord is valid\n   }\n    \n    void get_coord(string s1, string s2, vector<string>& res) {\n        int n1=s1.size(), n2=s2.size();\n        for(int i=0;i<n1;i++){ \n            // get every possible partition, as before, but with point at the middle\n            // es. s1 = 1234 -> (.1234), (1.234), (12.234), (123.4)\n            string s11 = s1.substr(0,i);\n            string s12 = s1.substr(i);\n            string t1 = s11 + "." + s12;\n            if(t1[0] == \'.\') // remove initial point if present\n                t1=t1.substr(1);\n            if(valid(t1)){ // if it is valid, look at the second string\n                for(int i=0;i<n2;i++){\n                    string s21 = s2.substr(0,i);\n                    string s22 = s2.substr(i);  \n                    string t2 = s21 + "." + s22;\n                    if(t2[0] == \'.\') // remove initial point if present\n                        t2=t2.substr(1);\n                    if(valid(t2)){ // if the second is valid too, add to res\n                        res.push_back("("+t1+", "+t2+")");\n                    }\n                }\n            }\n        }\n    }   \n    \n    vector<string> ambiguousCoordinates(string s) {\n        s = s.substr(1,s.size()-2); // string without ( )\n        vector<string> res;\n        int n=s.size();\n        for(int i=0;i<n;i++) {\n            // get every double partition of string\n            // es. s = 1234 -> (, 1234), (1, 234), (12, 234), (123, 4)\n            get_coord(s.substr(0,i), s.substr(i), res); \n        }\n        return res;\n    }\n};\n```
['C++', 'Java']