#K51237. Binary to Hexadecimal Conversion

    ID: 29043 Type: Default 1000ms 256MiB

Binary to Hexadecimal Conversion

Binary to Hexadecimal Conversion

You are given a binary string representing a non-negative integer. Your task is to convert this binary number into its hexadecimal representation in uppercase. The conversion must ignore any leading zeros in the output. For example, the binary string 1010 should be converted to A, and 11111010 should be converted to FA.

The mathematical conversion can be expressed as follows:

\(\text{Hexadecimal} = \text{toHex}\left(\sum_{i=0}^{n-1} b_i \times 2^{n-1-i}\right)\)

where \(b_i\) are the binary digits of the input string. Make sure to read the input from standard input (stdin) and write the output to standard output (stdout).

inputFormat

The input consists of a single line containing a binary string. The binary string may have leading zeros but the hexadecimal representation should not have any unnecessary leading zeros.

Input Format:

A single line with a binary string.

outputFormat

Output a single line containing the uppercase hexadecimal representation of the given binary string with no leading zeros (except in the case of 0 itself).

Output Format:

A single line with the hexadecimal string.
## sample
1010
A