原题题目
代码实现(首刷自解)
class Solution {
public:string maximumBinaryString(string binary) {
string ret;int zero = 0,zeropos = binary.size()-1;for(int i=0;i<binary.size();++i) {
if(binary[i] == '0'){
if(!zero) zeropos = i;++zero;}}if(!zero) return binary;zeropos = zeropos + (zero-1);string temp(zeropos,'1');ret += temp;ret += '0';temp.assign(binary.size()-zeropos-1,'1');ret += temp;return ret;}
};