Back
Close
  • 85

Learning Opportunities

This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.

Statement

 Goal

This is part 1 of the Lost Astronaut series. Part 2: Lost Astronaut 2: Broken Transmitter (Hard).

We lost an astronaut in space! Luckily, he survived, and he built a signal transmitter from broken parts of his spaceship. It works, but it randomly converts some characters to binary, octal, or hexadecimal before sending them.

You are the best programmer we've got. Write a program that converts these values back and recovers the sentence the astronaut typed. Hurry: a transmitter made of broken parts won't last forever.

The message contains only letters and space, so the transmission only ever contains ASCII codes for those characters.
For example, if you receive "45", it is the hexadecimal code for the character E. It cannot be the octal code for %, because that character is not a letter or space.

Good luck!
Input
Line 1: an integer N, the number of characters in the original message
Line 2: a string MESSAGE made of N values separated by spaces. Each value is binary, octal, hexadecimal (lowercase) or the original character.
Output
The original sentence typed by the astronaut.
Constraints
2 ≤ N ≤ 350
MESSAGE only has A to Z, a to z, and space ( )
Example
Input
4
1110100 1100101 1110011 1110100
Output
test

A higher resolution is required to access the IDE