← Back to challenges

Spartans Decipher

PythonHardalgorithmscryptographylogicstrings

Instructions

In Spartans Cipher, encoding is done by writing the text horizontally, across the strap in the plaintext word of a message. In ancient times, Spartans and Greeks invented interesting way of encryption called Scytale. The detailed description of the encoding algorithm is provided by Mubashir in his challenge. You are encouraged to solve that one first.

In this challenge, the function is given the encoded message and the number of slides. Create a reversed solution to retrieve the original message.

Examples

spartans_decipher("Ms t euhSaC biclo aryed", 6) ➞ "Mubashir Scytale Code"

spartans_decipher("M  baai aaEirmn tndteag tda  z", 8) ➞ "Matt and Innokodakademija are amazing"

Notes

Strip white spaces on the right of the resulting string, because they were added during the encoding.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.