code: 
  
  
  
  
  
  
  '''simple docstring'''
  
  
  
  
  
  from __future__ import annotations
  def        UpperCAmelCase      (   _lowercase,      _lowercase      ):
  
  
      '''simple docstring'''
  
  
  
      _lowercase ,    _lowercase ,    _lowercase     =	'', '', ''
      _lowercase     =	[]
  
      for character in message_part:
          tmp.append(character_to_number[character]      )
  
      for each in tmp:
          one += each[0]
          two += each[1]
          three += each[2]
  
      return one + two + three
  def        UpperCAmelCase      (   _lowercase,      _lowercase      ):
  
  
      '''simple docstring'''
  
  
  
      _lowercase ,    _lowercase     =	'', ''
      _lowercase     =	[]
  
      for character in message_part:
          this_part += character_to_number[character]
  
      for digit in this_part:
          tmp += digit
          if len(_lowercase      ) == len(_lowercase      ):
              result.append(_lowercase      )
              _lowercase     =	''
  
      return result[0], result[1], result[2]
  def        UpperCAmelCase      (   _lowercase,      _lowercase      ):
  
  
      '''simple docstring'''
  
  
  
      _lowercase     =	alphabet.replace(' ',      ''      ).upper()
      _lowercase     =	message.replace(' ',      ''      ).upper()
  
      # Check length and characters
      if len(_lowercase      ) != 27:
          raise KeyError('Length of alphabet has to be 27.'      )
      for each in message:
          if each not in alphabet:
              raise ValueError('Each message character has to be included in alphabet!'      )
  
      # Generate dictionares
      _lowercase     =	(
          '111',
          '112',
          '113',
          '121',
          '122',
          '123',
          '131',
          '132',
          '133',
          '211',
          '212',
          '213',
          '221',
          '222',
          '223',
          '231',
          '232',
          '233',
          '311',
          '312',
          '313',
          '321',
          '322',
          '323',
          '331',
          '332',
          '333',
      )
      _lowercase     =	{}
      _lowercase     =	{}
      for letter, number in zip(_lowercase,      _lowercase      ):
          _lowercase     =	number
          _lowercase     =	letter
  
      return message, alphabet, character_to_number, number_to_character
  def        UpperCAmelCase      (   _lowercase,      _lowercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.",      _lowercase = 5      ):
  
  
      '''simple docstring'''
  
  
  
      _lowercase ,    _lowercase ,    _lowercase ,    _lowercase     =	__prepare(
          _lowercase,      _lowercase      )
      _lowercase ,    _lowercase     =	'', ''
  
      for i in range(0,      len(_lowercase      ) + 1,      _lowercase      ):
          encrypted_numeric += __encrypt_part(
              message[i : i + period],      _lowercase      )
  
      for i in range(0,      len(_lowercase      ),      3      ):
          encrypted += number_to_character[encrypted_numeric[i : i + 3]]
  
      return encrypted
  def        UpperCAmelCase      (   _lowercase,      _lowercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.",      _lowercase = 5      ):
  
  
      '''simple docstring'''
  
  
  
      _lowercase ,    _lowercase ,    _lowercase ,    _lowercase     =	__prepare(
          _lowercase,      _lowercase      )
      _lowercase     =	[]
      _lowercase     =	''
  
      for i in range(0,      len(_lowercase      ) + 1,      _lowercase      ):
          _lowercase ,    _lowercase ,    _lowercase     =	__decrypt_part(message[i : i + period],      _lowercase      )
  
          for j in range(0,      len(_lowercase      )      ):
              decrypted_numeric.append(a[j] + b[j] + c[j]      )
  
      for each in decrypted_numeric:
          decrypted += number_to_character[each]
  
      return decrypted
  
  
  if __name__ == "__main__":
     lowerCamelCase										=  '''DEFEND THE EAST WALL OF THE CASTLE.'''
     lowerCamelCase										=  encrypt_message(msg, '''EPSDUCVWYM.ZLKXNBTFGORIJHAQ''')
     lowerCamelCase										=  decrypt_message(encrypted, '''EPSDUCVWYM.ZLKXNBTFGORIJHAQ''')
     print(f"Encrypted: {encrypted}\nDecrypted: {decrypted}")
  
style_context: 
  
  
  
  
  
  
  from __future__ import annotations
  def        UpperCAmelCase      (   _lowercase,      _lowercase      ):
  
  
      '''simple docstring'''
  
  
  
      _lowercase     =	[None] * (len(_lowercase      ) + len(_lowercase      ))
  
      _lowercase     =	0  # pointer to current index for left Half
      _lowercase     =	0  # pointer to current index for the right Half
      _lowercase     =	0  # pointer to current index for the sorted array Half
  
      while pointera < len(_lowercase      ) and pointera < len(_lowercase      ):
          if left_half[pointera] < right_half[pointera]:
              _lowercase     =	left_half[pointera]
              pointera += 1
              index += 1
          else:
              _lowercase     =	right_half[pointera]
              pointera += 1
              index += 1
      while pointera < len(_lowercase      ):
          _lowercase     =	left_half[pointera]
          pointera += 1
          index += 1
  
      while pointera < len(_lowercase      ):
          _lowercase     =	right_half[pointera]
          pointera += 1
          index += 1
  
      return sorted_array
  def        UpperCAmelCase      (   _lowercase      ):
  
  
      '''simple docstring'''
  
  
  
      if len(_lowercase      ) <= 1:
          return array
      # the actual formula to calculate the middle element = left + (right - left) // 2
      # this avoids integer overflow in case of large N
      _lowercase     =	0 + (len(_lowercase      ) - 0) // 2
  
      # Split the array into halves till the array length becomes equal to One
      # merge the arrays of single length returned by mergeSort function and
      # pass them into the merge arrays function which merges the array
      _lowercase     =	array[:middle]
      _lowercase     =	array[middle:]
  
      return merge(merge_sort(_lowercase      ),      merge_sort(_lowercase      )      )
  
  
  if __name__ == "__main__":
     import doctest
  
     doctest.testmod()
  