Greedy | C++
\nclass Solution {\npublic:\n    string maximumBinaryString(string binary) {\n        int n = binary.size(), first = -1, cnt = 0;\n        for(int i=n-1; i>=0; 
```\nclass Solution {\npublic:\n    string maximumBinaryString(string binary) {\n        int n = binary.size(), first = -1, cnt = 0;\n        for(int i=n-1; i>=0; i--) {\n            cnt += binary[i] == \'0\';\n            if(binary[i] == \'0\') first = i;\n            binary[i] = \'1\';\n        }\n        if(!cnt) return binary;\n        binary[first + cnt - 1] = \'0\';\n        return binary;\n    }\n};\n\n\n```
['Greedy', 'C++']