C++ | Sorting | simple solution
Approach\nIn order to make it as larger as possible, you have to move as many 1s to the front as possible.\nIn this case, you can only move 1 to the left when b
## Approach\nIn order to make it as larger as possible, you have to move as many `1`s to the front as possible.\nIn this case, you can only move `1` to the left when binary[i] + binary[i+1] is `00`. So, you need to find the way to move as many `0` as possible to make it to `10`. \n\nOn the other hand, any `1` can be moved to the right(the end) unless it is `11`. It means that any `1` can be moved to the left until it faces `1` or the end of the string. In this case, all `0` will be going to the front.\n\nSo, you can move all `0` to the front and all `1` to right by iterating from `n-1`  to `0`. Or **you can just sort the string!**\n\nHowever, you don\'t need to move `1` at the leftmost side because it already satisfies the biggest condition.\n\nIn short,\n1) You can find the starting point of `0`.\n2) Sort from the starting point to the end.\n3) And change all `0` to `1` except the last one.\n\n```\nclass Solution {\npublic:\n    string maximumBinaryString(string binary) {\n        const int n = (int) binary.length();\n        int s = 0;\n        for (int i = 0; i < n; ++i) {\n            if (binary[i] == \'0\') {\n                break;\n            }\n            s++;\n        }\n        if (s < n) {\n            sort(binary.begin() + s, binary.end());\n            for (int i =s; i < n-1; ++i) {\n                if (binary[i] == \'0\' && binary[i+1] == \'0\') {\n                    binary[i] = \'1\';\n                }\n            }\n        }\n        return binary;\n    }\n};\n```
['C']