# DIFFICULTY: SIMPLE

#Assumptions: A Plaintext represents the original message. A Ciphertext represents the encrypted message. The keys are used to encrypt the plaintext. Consider \{A = 0, B = 1, \cdots ,Z = 25\} . There are no spaces, newline or other punctuation symbols in plain text

#Key Generation : Alice chooses two keys K_1, K_2 < 26 and securely send K_1, K_2 to Bob.

#Encryption : Encryption function is C = (P \times K_2) + K_1 \ mod \ 26 ; where P is the plaintext and C is the ciphertext.

#Decryption : Decryption function is P = (C − K_1) \times K_{2^{−1}} \ mod \ 26 ; where P is the plaintext and C is the cipher text; K_{2^{−1}} is the multiplicative inverse in GF(26) i.e. 1 = K_{2^{-1}} \times K_2 \ mod \ 26 .

#Example: If the Plaintext: HELLOWORLD = {7 4 11 11 14 22 14 17 11 3} Keys : K_1 = 3, K_2 = 7. K_{2^{-1}} = 15 as 7 \times 15 = 1 \ mod \ 26 . So the Cipher Text: AFCCXBXSCY = {0 5 2 2 23 1 23 18 2 24}.

First of all take the input HELLOWORLD as a string and in a for loop until the end of the string take the ASCII value of each character and subtract it by 65 if they are capital letters or by 97 if they are small letters and store these values in a array.Now do the manipulation of the values stored in the array according to the given equation. After that now to print the cipher text you need to take these manipulated values and add value of 65 to it.Now iterate through the array and print the corresponding ASCII values of each number in the array.Then you will get the cipher text.@tkh_iem I think this is too long to read but it doesn’t take much of your time.