





from __future__ import annotations

from string import ascii_letters




def        lowerCAmelCase_       (							UpperCamelCase_    ,						UpperCamelCase_    ,						UpperCamelCase_ = None     )   ->						str:
       UpperCamelCase_      				=     alphabet or ascii_letters

       # The final result string
       UpperCamelCase_      				=     ""

       for character in input_string:
              if character not in alpha:
                     # Append without encryption if character is not in the alphabet
                     result += character
              else:
                     # Get the index of the new key and make sure it isn't too large
                     UpperCamelCase_      				=     (alpha.index(UpperCamelCase_     ) + key) % len(UpperCamelCase_     )

                     # Append the encoded character to the alphabet
                     result += alpha[new_key]

       return result




def        lowerCAmelCase_       (							UpperCamelCase_    ,						UpperCamelCase_    ,						UpperCamelCase_ = None     )   ->						str:
       key *= -1

       return encrypt(UpperCamelCase_    ,						UpperCamelCase_    ,						UpperCamelCase_     )




def        lowerCAmelCase_       (							UpperCamelCase_    ,						UpperCamelCase_ = None     )   ->						dict[int, str]:
       UpperCamelCase_      				=     alphabet or ascii_letters

       # To store data on all the combinations
       UpperCamelCase_      				=     {}

       # Cycle through each combination
       for key in range(1    ,						len(UpperCamelCase_     ) + 1     ):
              # Decrypt the message and store the result in the data
              UpperCamelCase_      				=     decrypt(UpperCamelCase_    ,						UpperCamelCase_    ,						UpperCamelCase_     )

       return brute_force_data


if __name__ == "__main__":
     while True:
          print(f'''\n{'-' * 1_0}\n Menu\n{'-' * 1_0}''')
          print(*['1.Encrypt', '2.Decrypt', '3.BruteForce', '4.Quit'], sep='\n')

          # get user input
          _UpperCAmelCase				       = input('\nWhat would you like to do?: ').strip() or '4'

          # run functions based on what the user chose
          if choice not in ("1", "2", "3", "4"):
               print('Invalid choice, please enter a valid choice')
          elif choice == "1":
               _UpperCAmelCase				       = input('Please enter the string to be encrypted: ')
               _UpperCAmelCase				       = int(input('Please enter off-set: ').strip())

               print(encrypt(input_string, key))
          elif choice == "2":
               _UpperCAmelCase				       = input('Please enter the string to be decrypted: ')
               _UpperCAmelCase				       = int(input('Please enter off-set: ').strip())

               print(decrypt(input_string, key))
          elif choice == "3":
               _UpperCAmelCase				       = input('Please enter the string to be decrypted: ')
               _UpperCAmelCase				       = brute_force(input_string)

               for key, value in brute_force_data.items():
                    print(f'''Key: {key} | Message: {value}''')

          elif choice == "4":
               print('Goodbye.')
               break








def        lowerCAmelCase_       (							UpperCamelCase_    ,						UpperCamelCase_     )   ->						list:
       UpperCamelCase_      				=     sorted(UpperCamelCase_    ,						key=lambda UpperCamelCase_     : value[2]    ,						reverse=UpperCamelCase_     )

       # Create a list of size equal to the maximum deadline
       # and initialize it with -1
       UpperCamelCase_      				=     max(UpperCamelCase_    ,						key=lambda UpperCamelCase_     : value[1]     )[1]
       UpperCamelCase_      				=     [-1] * max_deadline

       # Finding the maximum profit and the count of jobs
       UpperCamelCase_      				=     0
       UpperCamelCase_      				=     0
       for job in jobs:
              # Find a free time slot for this job
              # (Note that we start from the last possible slot)
              for i in range(job[1] - 1    ,						-1    ,						-1     ):
                     if time_slots[i] == -1:
                            UpperCamelCase_      				=     job[0]
                            count += 1
                            max_profit += job[2]
                            break
       return [count, max_profit]


if __name__ == "__main__":
     import doctest

     doctest.testmod()

