#C7352. Hexadecimal String Decoder
Hexadecimal String Decoder
Hexadecimal String Decoder
You are given a set of hexadecimal encoded strings. In the encoding scheme, each character of the original string is represented by its two-digit lowercase hexadecimal ASCII code. For example, the string "abc" is encoded as "616263" because each character is encoded as follows:
- a : 61
- b : 62
- c : 63
Your task is to decode each hexadecimal string to recover the original string.
The conversion for each character can be described by the formula:
$$c = \operatorname{char}(\text{int}(\text{hex pair}, 16)) $$where hex pair represents two hexadecimal digits corresponding to a character.
Note: An empty string should decode to an empty string.
Examples:
Input: 3 616263 6e6f746573 68656c6c6f776f726c64</p>Output: abc notes helloworld
inputFormat
The input is read from standard input (stdin) and is formatted as follows:
- The first line contains an integer
T
representing the number of hexadecimal encoded strings. - The following
T
lines each contain a non-negative hexadecimal encoded string.
Note that the hexadecimal string can be empty.
outputFormat
For each encoded string, output its decoded original string on a separate line to standard output (stdout).
## sample3
616263
6e6f746573
68656c6c6f776f726c64
abc
notes
helloworld
</p>