Spartans Decipher

Published by Deep Xavier in

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 details of the encoding algorithm is described in this 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

spartansDecipher("IOHOIEAMIVTSMUNEHHSCLWTA", 6) ➞ "IAMSOMUCHINLOVEWITHTESHA" 

spartansDecipher("T vyete sh lheoi  ffil esom.", 4) ➞ "Tesh is the love of my life."

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

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

Notes

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

Watch a quick demo on how Edabit works.