This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
GoalYour 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:
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.
Line 1: The encoded message of
Line 1: The decoded message, or the word INVALID when the input is not valid.
N < 4096
0 0 00 00000 0 0
A higher resolution is required to access the IDE