Company: Citi Bank - Hirepro
Difficulty: medium
Write a program to encrypt a text message using a key. Each character in the key word represents a shift value based on its distance from the letter 'a' (where 'a' has a distance of 0, 'b' has a distance of 1, and so on, up to 'z' which has a distance of 25). The characters of the text message are shifted forward by the corresponding shift values of the key characters. If the key is shorter than the text message, the key characters are reused cyclically. The shift wraps around the alphabet (i.e., after 'z', it wraps back to 'a'). Input Format The first line of input contains the key string. The second line of input contains the text message to be encrypted. Output Format A single line of output contains E , which is the encrypted text message. Sample Input 1 sum elephant Sample Output 1 wfqhbmfn Explanation 1 Character s u m Distance from 'a' 18 20 12 Character e l e p h a n t Shift number 18 20 12 18 20 12 18 20 Substitution Character w f q h b m f n Thus elephant is encrypted as wfqh