🔥 JUST COUNT ONES! 🔥
Just count the separate ones (except the ones at the beginning), make a new string of size n ones, and put one zero at position n - cntr - 1. \n# That\'s it!\n\
# Just count the separate ones (except the ones at the beginning), make a new string of size `n` ones, and put one zero at position `n - cntr - 1`. \n# That\'s it!\n\n# Code\n```\nclass Solution {\npublic:\n    string maximumBinaryString(string s) \n    {\n        int n = s.size(), cntr = 0, i = 0;\n\n        while(s[i] == \'1\') i++;\n\n        if(i == n) return s;\n        \n        for(; i < n; i++)\n        {\n            if(s[i] == \'1\') cntr++;\n        }\n\n        string res(n, \'1\');\n        res[n - cntr - 1] = \'0\';\n\n        return res;\n    }\n};\n```
['String', 'Greedy', 'C', 'Counting', 'C++', 'Java']