example simple and very old method of sending secret messages is the substitution cipher basicallyeach letter of the alphabet gets replaced by another letter of the alphabetsay every gets replaced with an xand every gets replaced by zetc write program to implement this alphabet 'abcdefghijklmnopqrstuvwxyz key 'xznlwebgjhqdyvtkfuompciasr secret_message input'enter your message'secret_message secret_message lower(for in secret_messageif isalpha()print(key[alphabet index( )],end''elseprint(cend''the string key is random reordering of the alphabet the only tricky part of the program is the for loop what it does is go through the message one character at timeandfor every letter it findsit replaces it with the corresponding letter from the key this is accomplished by using the index method to find the position in the alphabet of the current letter and replacing that letter with the letter from the key at that position all non-letter characters are copied as is the program uses the isalpha method to tell whether the current character is letter or not the code to decipher message is nearly the same just change key[alphabet index( )to alphabet[key index( )section provides different approach to the substitution cipher exercises write program that asks the user to enter string the program should then print the following(athe total number of characters in the string (bthe string repeated times (cthe first character of the string (remember that string indices start at (dthe first three characters of the string (ethe last three characters of the string (fthe string backwards (gthe seventh character of the string if the string is long enough and message otherwise (hthe string with its first and last characters removed (ithe string in all caps (jthe string with every replaced with an