# Problem of the Week Problem A and Solution The Keys to Hidden Messages

## Problem

There are many ways to encode messages. Here is an encoding using just zeros and ones.

0 0 0 1 1 0 0 1 0 1 1 0 1 1 1 0

This single sequence could represent many different messages. To decode the information correctly, you need a key. The actual message that the encoding represents depends on the key you use to decode it.

Here are two keys which could be used to decode the message:

Alpha Key
Letter Code
C 1 0 0
D 1 0 1 0
E 0 1
O 1 1 1
R 1 0 1 1
S 0 0
T 1 1 0
Beta Key
Letter Code
C 0 0 0 1
D 0 1 1 0
E 1 1 1 0
O 1 0 0 1
R 1 0 1 0
S 0 1 0 1
T 1 0 1 1
1. What is the message if you decode it using the Alpha Key?

2. What is the message if you decode it using the Beta Key?

## Solution

We can use pattern matching to decode the message with each key.

1. The first row of the following table contains the message broken up into six pieces. Notice that each of these pieces is a code in the Alpha Key. The second row of the table contains the letter corresponding to each code.

0 0 0 1 1 0 0 1 0 1 1 0 1 1 1 0
S E C R E T

Therefore, the message is “SECRET” when decoded using the Alpha Key.

2. The table below was created using a similar process as in part (a), except instead for the Beta Key.

0 0 0 1 1 0 0 1 0 1 1 0 1 1 1 0
C O D E

Therefore, the message is “CODE” when decoded using the Beta Key.