#K36957. Simple Substitution Cipher
Simple Substitution Cipher
Simple Substitution Cipher
You are given a plaintext message consisting exclusively of lowercase English letters and an integer key. Your task is to encrypt the message using a simple substitution cipher. For each character c in the plaintext, compute its encrypted version using the formula:
$$ encrypted = ((\text{ord}(c)-\text{ord}('a')+ key)\mod 26) + \text{ord}('a') $$
The result should be the corresponding character after the shift. For example, if the letter is 'a' and the key is 3, then the output character is 'd'. Note that the cipher wraps around at 'z'.
Your solution should read the input from stdin
and write the answer to stdout
.
inputFormat
The input consists of two lines. The first line is the plaintext string containing only lowercase letters. The second line is an integer key representing the shift value.
outputFormat
Output the encrypted message produced by shifting each letter in the plaintext by the given key modulo 26.
## sampleabc
3
def