Simple Explained Solution
\n\nclass Solution {\n    public String maximumBinaryString(String s) {\n        int ones = 0, zeros = 0, n = s.length();\n        StringBuilder res = new Strin
\n```\nclass Solution {\n    public String maximumBinaryString(String s) {\n        int ones = 0, zeros = 0, n = s.length();\n        StringBuilder res = new StringBuilder("1".repeat(n));\n        for (int i = 0; i < n; ++i) {\n            if (s.charAt(i) == \'0\')\n                zeros++;\n            else if (zeros == 0)\n                ones++;\n        }\n        if (ones < n)\n            res.setCharAt(ones + zeros - 1, \'0\');\n        return res.toString();\n    }\n}\n```
['Swift', 'Java', 'Go', 'Ruby', 'Bash']