Back
Close

Code Breaker

Statement

 Goal

The task is to decode a secret message. Each message is encoded using a simple Caesar cipher. In addition a word is provided which is guaranteed to exist in the secret message.

Refresher on Caesar cipher (safe to skip if you are familiar with this cipher)
To encrypt the message "HELLO" with a Caesar cipher with a shift of 1, shift every letter by one. H becomes I, E becomes F, and so on. The encrypted message is "IFMMP". If the shift was 2, the encrypted message would be "JGNNQ". If the shift reaches the end of the letters then it wraps around to the beginning. For example, if the whole vocabulary is ABC, and the shift is 1, then A become B, B becomes C, C becomes A.

For this puzzle, the shift is not provided but the solution involves discovering it. The shift may be different for every test case.

There is only one unique solution to each test. Specifically, there is only one shift per test which decodes the message to contain the given word.
Input
Line 1: ALPHABET The characters in the cipher
Line 2: MESSAGE The encrypted message
Line 3: WORD The word that is in the message
Output
Line 1 Decrypted message
Constraints
ALPHABET contains only visible basic ascii characters such as 'a', '8', '{'. No spaces, tabs, bell, or emoji.
1 ≤ N ≤ 10
All strings are 200 characters or less.
Example
Input
ABCDEFGHIJKLMNOPQRSTUVWXYZ_
IFMMPAXPSME
WORLD
Output
HELLO_WORLD

Game modes
FastestShortest

Test cases
Hello World Test
Input
ABCDEFGHIJKLMNOPQRSTUVWXYZ_ IFMMPAXPSME WORLD
Output
HELLO_WORLD

Hello World Validator
Input
ABCDEFGHIJKLMNOPQRSTUVWXYZ_ XPSMEAIFMMP WORLD
Output
WORLD_HELLO

Baking your code Test
Input
ABCDEFGHIJKLMNOPQRSTUVWXYZ_ APMHXQMHQ_HQVHAPMHWCMV PIE
Output
THE_PIE_IS_IN_THE_OVEN

Baking your code Validator
Input
ABCDEFGHIJKLMNOPQRSTUVWXYZ_ MAYTIBYTBLTBGTMAYTHOYG OVEN
Output
THE_PIE_IS_IN_THE_OVEN

Ominous Test
Input
ABCDE1FGH2IJK5LMN7OPQR8STU9VWXYZ_ AVU5QVYWJVNQJVXQPVEVU5QVYWJPVD1Z_ HIDE
Output
1_YOU_CAN_RUN_BUT_2_YOU_CANT_HIDE

Ominous Validator
Input
ABCDEFGHIJKLMNOPQRSTUVWXYZ_1234509876 SRPFLR42EKRILER3LKRTRPFLR42ER7650 CANT
Output
1_YOU_CANT_RUN_BUT_2_YOU_CAN_HIDE

Fun Message Test
Input
A1B2C3D4E5F6G7H8I9J0K-L+M=NOP;Q:R<S>T?U,V.W/XY|Z_ /-8DA42D546OD+.D4D;S<0D,S47D+9D2SYD;S.8D2SY,D:4>PY<O<SA< UNKNOWN
Output
THE_WAY_BACK_IS_A_LONG_ROAD_IF_YOU_LOSE_YOUR_MAP-UNKNOWN

Fun Message Validator
Input
B2C3D4E5FA6G7H18I9J0K-L+M=N[O]P;Q:R<S>T?U,V.W/XY|Z_ 0,=;9[7B?1<],71B1|;5<B>;635B69[?B+9-5B4,>?9[7B3<];>B2]| DUSTING
Output
JUMPING_THROUGH_HYPER_SPACE_AINT_LIKE_DUSTING_CROPS_BOY

Solution language

Solution

Stub generator input
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants