A higher resolution is required to access the IDE
- 2800
Learning Opportunities
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
Statement
Goal
During World War II, the Germans were using an encryption code called Enigma – which was basically an encryption machine that encrypted messages for transmission. The Enigma code went many years unbroken. Here's How the basic machine works:First Caesar shift is applied using an incrementing number:
If String is
A + 4 = E A + 4 + 1 = F A + 4 + 1 + 1 = G
Now map
ABCDEFGHIJKLMNOPQRSTUVWXYZSo
BDFHJLCPRTXVZNYEIWGAKMUSQO
If the second ROTOR is
ABCDEFGHIJKLMNOPQRSTUVWXYZSo
AJDKSIRUXBLHWTMCQGZNPYFVOE
If the third ROTOR is
ABCDEFGHIJKLMNOPQRSTUVWXYZSo
EKMFLGDQVZNTOWYHXUSPAIBRCJ
Final output is sent via Radio Transmitter.
Input
Line 1: ENCODE or DECODE
Line 2: Starting shift N
Lines 3-5:
BDFHJLCPRTXVZNYEIWGAKMUSQO ROTOR I
AJDKSIRUXBLHWTMCQGZNPYFVOE ROTOR II
EKMFLGDQVZNTOWYHXUSPAIBRCJ ROTOR III
Line 6: Message to Encode or Decode
Line 2: Starting shift N
Lines 3-5:
Line 6: Message to Encode or Decode
Output
Encoded or Decoded String
Constraints
0 ≤ N < 26
Message consists only of uppercase letters (A-Z)
1 ≤ Message length < 50
Message consists only of uppercase letters (A-Z)
1 ≤ Message length < 50
Example
Input
ENCODE 4 BDFHJLCPRTXVZNYEIWGAKMUSQO AJDKSIRUXBLHWTMCQGZNPYFVOE EKMFLGDQVZNTOWYHXUSPAIBRCJ AAA
Output
KQF
A higher resolution is required to access the IDE