




"""simple docstring"""




from __future__ import annotations

from string import ascii_letters







def       __UpperCAmelCase      (				__UpperCamelCase					,							__UpperCamelCase					,							__UpperCamelCase = None					):
			__lowercase	:       Tuple				=   alphabet or ascii_letters

			# The final result string
			__lowercase	:       List[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
									__lowercase	:       Union[str, Any]				=   (alpha.index(__UpperCamelCase					) + key) % len(__UpperCamelCase					)

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

			return result







def       __UpperCAmelCase      (				__UpperCamelCase					,							__UpperCamelCase					,							__UpperCamelCase = None					):
			key *= -1

			return encrypt(__UpperCamelCase					,							__UpperCamelCase					,							__UpperCamelCase					)







def       __UpperCAmelCase      (				__UpperCamelCase					,							__UpperCamelCase = None					):
			__lowercase	:       List[Any]				=   alphabet or ascii_letters

			# To store data on all the combinations
			__lowercase	:       int				=   {}

			# Cycle through each combination
			for key in range(1					,							len(__UpperCamelCase					) + 1					):
						# Decrypt the message and store the result in the data
						__lowercase	:       int				=   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
						a_            =   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":
									a_            =   input('Please enter the string to be encrypted: ')
									a_            =   int(input('Please enter off-set: ').strip())

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

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

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

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









"""simple docstring"""




# A Bipartite Graph is a graph whose vertices can be divided into two independent sets,
# U and V such that every edge (u, v) either connects a vertex from U to V or a vertex
# from V to U. In other words, for every edge (u, v), either u belongs to U and v to V,
# or u belongs to V and v to U. We can also say that there is no edge that connects
# vertices of same set.
from queue import Queue







def       __UpperCAmelCase      (				__UpperCamelCase					):
			__lowercase	:       int				=   Queue()
			__lowercase	:       str				=   [False] * len(__UpperCamelCase					)
			__lowercase	:       str				=   [-1] * len(__UpperCamelCase					)

			def bfs():
						while not queue.empty():
									__lowercase	:       int				=   queue.get()
									__lowercase	:       List[str]				=   True

									for neighbour in graph[u]:
												if neighbour == u:
															return False

												if color[neighbour] == -1:
															__lowercase	:       str				=   1 - color[u]
															queue.put(__UpperCamelCase					)

												elif color[neighbour] == color[u]:
															return False

						return True

			for i in range(len(__UpperCamelCase					)					):
						if not visited[i]:
									queue.put(__UpperCamelCase					)
									__lowercase	:       int				=   0
									if bfs() is False:
												return False

			return True


if __name__ == "__main__":
			# Adjacency List of graph
			print(check_bipartite({0: [1, 3], 1: [0, 2], 2: [1, 3], 3: [0, 2]}))



