- 318
Learning Opportunities
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
Statement
Goal
Your program must decode the encoded message from the Chuck Norris encoding project.It is strongly recommended to have done the Chuck Norris project.
Link -> https://www.codingame.com/training/easy/chuck-norris
Here are some reminders about the Chuck Norris encoding method:
- The encoded message is unary, containing only sequences of zeroes separated by spaces.
- These sequences of zeroes always come in pairs.
- The first sequence of a pair can be either
- The second sequence of a pair is made of
For instance, if we want to encode the character A, we first start to write down the 7-bit ASCII code for A which is
Then we turn the binary into unary as follows:
1000001 ->
1000001 ->
1000001 ->
Therefore, the encoded message is 0 0 00 00000 0 0.
You are asked to do the reverse process, and thus print A when given the message 0 0 00 00000 0 0.
If the input is invalid, just print INVALID.
Input
Line 1: The encoded message of N characters.
Output
Line 1: The decoded message, or the word INVALID when the input is not valid.
Constraints
0 < N < 4096
Example
Input
0 0 00 00000 0 0
Output
A
A higher resolution is required to access the IDE