C++ Greedy Solution
Solution:\n\nKeep the 1\'s before the first \'0\' as they were. Pass all the zeroe\'s to the left of string,\nconevert all these 0\'s to 1 using first operation
**Solution:**\n\nKeep the 1\'s before the first \'0\' as they were. Pass all the zeroe\'s to the left of string,\nconevert all these 0\'s to 1 using first operation, one zero will be left. Then paste the remaining\n1\'s at the end.\n\n**Explanation:**\n\nBy repeatdly performing the first operation we can convert a continous string of 0\'s \nlike "00000" to "11110" i.e., convert the first n-1 zero\'s to 1.\n\nUsing the second the opeartion we can actually pass the zero\'s across 1\'s. But we should\nnot pass these zero\'s across the ones that are in the starting of the string.\n\n```\nstring maximumBinaryString(string binary) {\n        \n        int i, starting_ones = 0, zeros = 0, ones = 0, n = binary.length();\n        string ans;\n        \n        for(i = 0; i < n; i++) {\n            \n            if(binary[i] == \'1\')\n                starting_ones++;\n            else\n                break;\n        }\n        \n        for(i = starting_ones; i < n; i++) {\n            \n            if(binary[i] == \'0\')\n                zeros++;\n            else\n                ones++;\n        }\n        \n        for(i = 0; i < starting_ones; i++)\n            ans += \'1\';\n        for(i = 1; i < zeros; i++)\n            ans += \'1\';\n        \n        if(zeros > 0)                          // incase there are no zero\'s\n            ans += \'0\';\n        \n        for(i = 0; i < ones; i++)\n            ans += \'1\';\n        \n        return ans;\n    }\n```
[]