#K75467. Maximum Binary Permutation
Maximum Binary Permutation
Maximum Binary Permutation
Given a non-negative integer \(n\), you are required to rearrange the digits of its binary representation to form the largest possible integer (also represented in binary). Note that the binary representation of \(n\) is obtained by converting \(n\) to base 2 without leading zeros, except when \(n = 0\) (in which case the representation is simply "0").
The task is to output the binary permutation which, when interpreted as a binary number, yields the maximum possible integer. In other words, you need to sort the bits in descending order.
Example:
Input: 6 Binary of 6: 110 Largest permutation: 110
Note: If \(n = 0\), simply output "0".
inputFormat
The input is given via standard input (stdin) and consists of a single non-negative integer (n).
outputFormat
Output the largest possible binary permutation of (n)'s binary digits on standard output (stdout) as a string.## sample
0
0