



"""simple docstring"""







class   UpperCamelCase	:




	"""simple docstring"""






	def __init__(     self   ):
			_lowercase				: Optional[Any]     =   [0]
			_lowercase				: List[str]     =   0






	def    lowerCamelCase__					(     self				,UpperCAmelCase_   ):
			_lowercase				: Optional[Any]     =   self.__heap[i]
			while i // 2 > 0:
					if self.__heap[i] > self.__heap[i // 2]:
							_lowercase				: Dict     =   self.__heap[i // 2]
							_lowercase				: Dict     =   temporary
					i //= 2






	def    lowerCamelCase__					(     self				,UpperCAmelCase_   ):
			self.__heap.append(UpperCAmelCase_   )
			self.__size += 1
			self.__swap_up(self.__size   )






	def    lowerCamelCase__					(     self				,UpperCAmelCase_   ):
			while self.__size >= 2 * i:
					if 2 * i + 1 > self.__size:
							_lowercase				: Any     =   2 * i
					else:
							if self.__heap[2 * i] > self.__heap[2 * i + 1]:
									_lowercase				: Optional[Any]     =   2 * i
							else:
									_lowercase				: Optional[Any]     =   2 * i + 1
					_lowercase				: Optional[Any]     =   self.__heap[i]
					if self.__heap[i] < self.__heap[bigger_child]:
							_lowercase				: Any     =   self.__heap[bigger_child]
							_lowercase				: Dict     =   temporary
					_lowercase				: str     =   bigger_child






	def    lowerCamelCase__					(     self   ):
			_lowercase				: Optional[Any]     =   self.__heap[1]
			_lowercase				: str     =   self.__heap[self.__size]
			self.__size -= 1
			self.__heap.pop()
			self.__swap_down(1   )
			return max_value






	@property
	def    lowerCamelCase__					(     self   ):
			return self.__heap[1:]






	def __len__(     self   ):
			return self.__size


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		# create an instance of BinaryHeap
		UpperCAmelCase:  Optional[Any]			     =				BinaryHeap()
		binary_heap.insert(6)
		binary_heap.insert(10)
		binary_heap.insert(15)
		binary_heap.insert(12)
		# pop root(max-values because it is max heap)
		print(binary_heap.pop())  # 15
		print(binary_heap.pop())  # 12
		# get the list and size after operations
		print(binary_heap.get_list)
		print(len(binary_heap))







from __future__ import annotations

from string import ascii_letters






def 	lowerCamelCase_       (			_a      ,  _a      ,  _a = None			):




		"""simple docstring"""






		lowerCAmelCase__  :     List[Any]       	=   alphabet or ascii_letters

		# The final result string
		lowerCAmelCase__  :     Optional[Any]       	=   ''''''

		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
						lowerCAmelCase__  :     int       	=   (alpha.index(_a			) + key) % len(_a			)

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

		return result






def 	lowerCamelCase_       (			_a      ,  _a      ,  _a = None			):




		"""simple docstring"""






		key *= -1

		return encrypt(_a      ,  _a      ,  _a			)






def 	lowerCamelCase_       (			_a      ,  _a = None			):




		"""simple docstring"""






		lowerCAmelCase__  :     Optional[Any]       	=   alphabet or ascii_letters

		# To store data on all the combinations
		lowerCAmelCase__  :     Optional[int]       	=   {}

		# Cycle through each combination
		for key in range(1      ,  len(_a			) + 1			):
				# Decrypt the message and store the result in the data
				lowerCAmelCase__  :     Optional[int]       	=   decrypt(_a      ,  _a      ,  _a			)

		return brute_force_data


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

				# get user input
				lowerCamelCase		=						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":
						lowerCamelCase		=						input('''Please enter the string to be encrypted: ''')
						lowerCamelCase		=						int(input('''Please enter off-set: ''').strip())

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

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

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

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




