[c++]  Using a while loop, a goto statement and  two pointers with explanation
Let\'s take two string s="10110"     str="11011" the value of  binary string s is 2^4 +2^2 +2^1=22 and str is 2^4 +2^3+2^1+2^0=27. Both string have same no. of 
Let\'s take two string ```s="10110"     str="11011"``` the value of  binary string s is 2^4 +2^2 +2^1=22 and str is 2^4 +2^3+2^1+2^0=27. Both string have same no. of 1\'s and 0\'s but string which have more no. of 1\'s in the right most place has higher value (as value of a position i is 2^i) so decimal number  of that binary string will be greater.\nWe can perform two operations:\n1. `00->10`\n2. `10->01`\n\nI have used pointer `a` and `b`. `a` will simply iterate in string till it reaches `0` and next element is `1`(or string ends) and `b` will iterate till it  find a `0` (or string ends) when `a` stops.\nWe will convert all `00` which we encounter to`10`,(update in string binary ) if we find `01` then we will iterate in the remaining string till we find a `0` , as in  `s="01110110"`(`a`pointer is pointing at index` s[0]`  and `s[1]`have 1,we will find `0 ` at `s[4]`) we will start converting `10->01` till we get `00111110` then `00->10` which will make `10111110` (and we will store the index where we found our `0` so that we can starting searching from it,next time when required)\nIn actual we are not swapping every element in the code, as it will take time as `10->01` conversion is only shifting of `0` in the right direction, so assign `1` where we find `0`(i.e. assign `s[4]=\'1\'`) and and `1` in the position `a` pointer is pointing(i.e. `s[0]=\'1\'`)and `0` in the next position(i.e. `s[1]=\'0\'`) which will make`01` to `10`. Like this we will iterate in the string and perform the operation if required.\n\n\n```\nclass Solution {\npublic:\n    string maximumBinaryString(string binary) {\n        int a=0,b=0,c=-1;\n        while(a<binary.size()){\n            if(binary[a]==\'0\' && a<binary.size()-1){\n                b=a+1;\n                if(binary[b]==\'0\'){\n                    binary[a]=\'1\';\n                    a++;\n                }\n                else{\n                    if(c!=(-1))\n                        b=c;\n                    \n                    label:\n                    if(b==binary.size()-1)\n                        break;\n                    if(binary[b+1]==\'0\'){\n                        c=b+1;\n                        binary[b+1]=\'1\';\n                       binary[a]=\'1\';\n                       binary[a+1]=\'0\';\n                        a++;\n                    }\n                    else{\n                        b++;\n                        goto label;\n                    }\n                    \n                }\n                \n            }\n            else\n            a++;\n            \n        }\n        \n        return binary;\n    }\n};\n```
[]