[C++] | Time: O(n) | Space: O(1) | Greedy (Counting Zeros)
Key Point of solution:\n Operation 2 changes "10" to "01"\n So stirng "111101" can become "011111"                            \n So string "111100" can become "
Key Point of solution:\n* Operation 2 changes "10" to "01"\n* So stirng "111101" can become "011111"                            \n* So string "111100" can become "001111"\n* **Basicly this operation can drag all zeros to front**\n* **After dragging change all "00"s to "10"s**\n                                                                           \nSolution:                                                                   \n * Keep leading \'1\'s as they are                                             \n * Move all \'0\'s to front after leading \'1\'s                                \n * Change them using operation 1 ("00" -> "01", using this operation we will change all \'0\'s to \'1\' except last one)\n * Append left \'1\'s that were moved back by moving \'0\'s to front\n  \nExample:\n* input = "11100100100"\n* move all \'0\'s -> "111 **000000** 11"\n* change         -> "111 **111110** 11"\n\nOptimization:\n\n\n```\nclass Solution {\npublic:\n    string maximumBinaryString(string binary) {\n        // string result to return\n        string result = "";\n        \n        // 1. Append leading \'1\'s to result string\n        // if we encounter \'0\' break for cycle and substring from first \'0\' to end\n        int i = 0;\n        for(; i < binary.size() ; i++){\n            if(binary[i] == \'0\'){\n                binary = binary.substr(i);\n                break;\n            }\n            result += \'1\';\n        }\n        // 1.1 Check if we reached end without encountering zero\n        // at this point we have string consisting only of \'1\'s, which is already maximum\n        if(i == binary.size()){\n            return result;\n        }\n        \n        // 2. Count zeros\n        int zeros = 0;\n        for(int i = 0; i < binary.size(); i++){\n            if(binary[i] == \'0\'){\n                zeros++;\n            }\n        }\n        \n        // 3. Move all \'0\'s to front and change all \'0\' to \'1\' except last one.\n        for(int i = 0; i < zeros - 1; i++){\n            result += \'1\';\n        }\n        result += \'0\';\n        \n        // 4. Append left \'1\'s at the end of string.\n        for(int i = zeros ; i < binary.size() ; i++){\n            result += \'1\';\n        }\n        \n        return result;\n    }\n};\n```
['C']