Company: Tekion_SDE intern_On-campus_3july
Difficulty: medium
Question 22 - Cipher Recovery Problem Description A messaging system encrypts text written in lowercase English letters with a circular substitution rule. All 26 lowercase letters are placed, in some unknown order, around one circle. To encrypt a message, every letter is replaced by the letter that follows it on the circle when moving clockwise. The same circle is used for every position of one message. A valid circular arrangement must satisfy all of the following: every lowercase English letter appears on the circle exactly once, no letter maps to itself, the mapping forms one single cycle of length 26 (starting from any letter and repeatedly moving to the next letter visits all 26 letters before returning to the start). You are given several encrypted messages. Each message is handled independently, with its own unknown circle. For each encrypted message, find the lexicographically smallest original message that could have produced it under some valid circular arrangement of all 26