#K82387. Next Greater Binary Number

    ID: 35964 Type: Default 1000ms 256MiB

Next Greater Binary Number

Next Greater Binary Number

Given a binary string b, your task is to find the smallest binary number that is a permutation of b and is lexicographically larger than b. In other words, find the next permutation of the binary string. If no such permutation exists, print No greater binary number.

The lexicographical order here follows the standard dictionary order, i.e. a binary string is considered smaller if at the first differing position it has a 0 where the other has a 1.

Note: The input string can have an equal number of 0s and 1s, but may also include single-bit cases. In the latter case, since no permutation is possible, the output should be No greater binary number.

inputFormat

The input is provided via standard input (stdin) and consists of a single line containing a binary string b.

outputFormat

Output to standard output (stdout) the next greater binary permutation of b if it exists; otherwise, output No greater binary number.

## sample
1010
1100

</p>