50 ms Python solution
We will have only one 0 in the final string, and its position is determined by the position of first 0 and number of 0s.\n\n# Code\n\nclass Solution(object):\n 
We will have only one 0 in the final string, and its position is determined by the position of first 0 and number of 0s.\n\n# Code\n```\nclass Solution(object):\n    def maximumBinaryString(self, binary):\n        """\n        :type binary: str\n        :rtype: str\n        """\n\n        n0 = binary.count(\'0\')\n        if n0 < 2: return binary\n        ll = len(binary)\n        p0 = binary.index(\'0\')\n        return \'1\' * (p0 + n0 - 1) + \'0\' + \'1\' * (ll - p0 - n0)\n```
['Python']