


import random
import sys

UpperCAmelCase			=    """ABCDEFGHIJKLMNOPQRSTUVWXYZ"""






def        __lowerCAmelCase    ()->  None:




      """simple docstring"""

      snake_case_       =      input('''Enter message: '''					)
      snake_case_       =      '''LFWOAYUISVKMNXPBDCRJTQEGHZ'''
      snake_case_       =      input('''Encrypt/Decrypt [e/d]: '''					)

      check_valid_key(SCREAMING_SNAKE_CASE					)

      if resp.lower().startswith('''e'''					):
            snake_case_       =      '''encrypt'''
            snake_case_       =      encrypt_message(SCREAMING_SNAKE_CASE					,					SCREAMING_SNAKE_CASE					)
      elif resp.lower().startswith('''d'''					):
            snake_case_       =      '''decrypt'''
            snake_case_       =      decrypt_message(SCREAMING_SNAKE_CASE					,					SCREAMING_SNAKE_CASE					)

      print(f'''\n{mode.title()}ion: \n{translated}'''					)






def        __lowerCAmelCase    (SCREAMING_SNAKE_CASE					)->  None:




      """simple docstring"""

      snake_case_       =      list(SCREAMING_SNAKE_CASE					)
      snake_case_       =      list(SCREAMING_SNAKE_CASE					)
      key_list.sort()
      letters_list.sort()

      if key_list != letters_list:
            sys.exit('''Error in the key or symbol set.'''					)






def        __lowerCAmelCase    (SCREAMING_SNAKE_CASE					,					SCREAMING_SNAKE_CASE					)->  str:




      """simple docstring"""

      return translate_message(SCREAMING_SNAKE_CASE					,					SCREAMING_SNAKE_CASE					,					'''encrypt'''					)






def        __lowerCAmelCase    (SCREAMING_SNAKE_CASE					,					SCREAMING_SNAKE_CASE					)->  str:




      """simple docstring"""

      return translate_message(SCREAMING_SNAKE_CASE					,					SCREAMING_SNAKE_CASE					,					'''decrypt'''					)






def        __lowerCAmelCase    (SCREAMING_SNAKE_CASE					,					SCREAMING_SNAKE_CASE					,					SCREAMING_SNAKE_CASE					)->  str:




      """simple docstring"""

      snake_case_       =      ''''''
      snake_case_       =      LETTERS
      snake_case_       =      key

      if mode == "decrypt":
            snake_case_       ,    snake_case_       =      chars_b, chars_a

      for symbol in message:
            if symbol.upper() in chars_a:
                  snake_case_       =      chars_a.find(symbol.upper()					)
                  if symbol.isupper():
                        translated += chars_b[sym_index].upper()
                  else:
                        translated += chars_b[sym_index].lower()
            else:
                  translated += symbol

      return translated






def        __lowerCAmelCase    ()->  str:




      """simple docstring"""

      snake_case_       =      list(SCREAMING_SNAKE_CASE					)
      random.shuffle(SCREAMING_SNAKE_CASE					)
      return "".join(SCREAMING_SNAKE_CASE					)


if __name__ == "__main__":
   main()



def        __lowerCAmelCase    (SCREAMING_SNAKE_CASE					)->  int:




      """simple docstring"""

      if number != int(SCREAMING_SNAKE_CASE					):
            raise ValueError('''factorial() only accepts integral values'''					)
      if number < 0:
            raise ValueError('''factorial() not defined for negative values'''					)
      snake_case_       =      1
      for i in range(1					,					number + 1					):
            value *= i
      return value






def        __lowerCAmelCase    (SCREAMING_SNAKE_CASE					)->  int:




      """simple docstring"""

      if not isinstance(SCREAMING_SNAKE_CASE					,					SCREAMING_SNAKE_CASE					):
            raise ValueError('''factorial() only accepts integral values'''					)
      if n < 0:
            raise ValueError('''factorial() not defined for negative values'''					)
      return 1 if n == 0 or n == 1 else n * factorial(n - 1					)


if __name__ == "__main__":
   import doctest

   doctest.testmod()

   UpperCAmelCase			=    int(input("""Enter a positive integer: """).strip() or 0)
   print(f'''factorial{n} is {factorial(n)}''')