Beats 99.47% solution || C++ | Easy Approach
image.png\n\n# Intuition\n Describe your first thoughts on how to solve this problem. \nCount the number of zeroes in the string and then add count -1 zeroes\na
image.png\n![image.png](https://assets.leetcode.com/users/images/20d3891a-751d-4fc2-a86b-675963ddf96b_1712984877.4088366.png)\n# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nCount the number of zeroes in the string and then add count -1 zeroes\nand then add zero to count postion .\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n        1. Count the zeroes.\n        2. Intialize an res string with 1 and size of original string.\n        3. To count position update the char \'1\' to \'0\'.\n        4. Return the ans.\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n        O(N)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n        O(1)\n\n# Code\n```\n#pragma gcc optimize("03")\nauto init  = [](){\n    ios::sync_with_stdio(0);\n    cin.tie(0);\n    cout.tie(0);\n    return \'c\';\n}();\nclass Solution {\npublic:\n    string maximumBinaryString(string binary) {\n      int cnt =0;\n      for(char &i:binary)if(i==\'0\')cnt++;\n      string ans(binary.size() ,\'1\');\n      for(int i =0 ; i<binary.size() ; i++){\n        if(binary[i] == \'0\'){\n            ans [i+cnt-1] = \'0\';\n            return ans;\n        }\n      }\n      return ans;\n    }\n};\n```
['C++']