class Solution {
public String maximumOddBinaryNumber(String s) {
int zeros = (int) s.chars().filter(c -> c == ‘0’).count();
int ones = s.length() – zeros;
return “1”.repeat(ones – 1) + “0”.repeat(zeros) + “1”;
}
}
class Solution {
public: string maximumOddBinaryNumber(string s) {
int zeros = ranges::count(s, ‘0’);
int ones = s.length() – zeros;
return string(ones – 1, ‘1’) + string(zeros, ‘0’) + ‘1’;
}
};
class Solution:
def maximumOddBinaryNumber(self, s: str) -> str:
return ‘1’ * (s.count(‘1’) – 1) + ‘0’ * s.count(‘0’) + ‘1’