Cipher Text
This Python script is designed to decipher text encrypted with a Caesar cipher — a classical substitution cipher that shifts letters in the alphabet by a fixed number of positions. It automatically tests all 26 possible shifts to find the original message by looking for a known word provided by the user.
Attempts all 26 possible Caesar cipher shifts automatically. Preserves uppercase and lowercase letters during decryption. Ignores non-alphabetic characters (spaces, punctuation, etc.). Stops and returns the first decoded text containing the known keyword. Returns "Invalid" if no valid decoding is found.
The program defines a helper function shift_text() that shifts each character backward through the alphabet. It loops through all possible shift values (0–25). For each decoded attempt, it checks if the user-provided known word appears in the text. Once a match is found, the program outputs the decoded message.
Input: Khoor Zruog World
Output: Hello World