C++ 6 line
two rule:\n100...0000 => 00...0001  all the 0 after a 1 can move to before the 1.\n00....000 => 111...1110  \nso, for 00..1.00..11..000....11..000, we can move 
two rule:\n100...0000 => 00...0001  all the 0 after a 1 can move to before the 1.\n00....000 => 111...1110  \nso, for 00..1.00..11..000....11..000, we can move all the 0 to the right:\nit becomes like 000...0011111...1111\nthen conver the leading 000...00 to 111...110\n\n```\n    string maximumBinaryString(string s) {\n        int num0 = count(s.begin(), s.end(), \'0\');\n        if(num0 == 0) return s;\n        int n = s.size(), i = s.find(\'0\');               \n        string res(n, \'1\');\n        res[i + num0 - 1] = \'0\';\n        return res;\n    }
[]