






from __future__ import annotations




class 							a_				:


							'''simple docstring'''






							def __init__(	self    ,    lowercase_     )      ->      None:
														'''simple docstring'''

														lowerCAmelCase_       		=  vertices
														lowerCAmelCase_       		=  [[0] * vertices for _ in range(lowercase_     )]

							def   _lowercase (	self    ,    lowercase_     )      ->      None:
														'''simple docstring'''

														print('Vertex \t Distance from Source'     )
														for vertex in range(self.vertices     ):
																					print(lowercase_    ,    '\t\t'    ,    distances_from_source[vertex]     )

							def   _lowercase (	self    ,    lowercase_    ,    lowercase_     )      ->      int:
														'''simple docstring'''

														lowerCAmelCase_       		=  1e7
														lowerCAmelCase_       		=  0

														# Search not nearest vertex not in the shortest path tree
														for vertex in range(self.vertices     ):
																					if distances_from_source[vertex] < minimum and visited[vertex] is False:
																												lowerCAmelCase_       		=  distances_from_source[vertex]
																												lowerCAmelCase_       		=  vertex
														return min_index






							def   _lowercase (	self    ,    lowercase_     )      ->      None:
														'''simple docstring'''

														lowerCAmelCase_       		=  [int(1e7     )] * self.vertices  # distances from the source
														lowerCAmelCase_       		=  0
														lowerCAmelCase_       		=  [False] * self.vertices

														for _ in range(self.vertices     ):
																					lowerCAmelCase_       		=  self.minimum_distance(lowercase_    ,    lowercase_     )
																					lowerCAmelCase_       		=  True

																					# Update dist value of the adjacent vertices
																					# of the picked vertex only if the current
																					# distance is greater than new distance and
																					# the vertex in not in the shortest path tree
																					for v in range(self.vertices     ):
																												if (
																												    self.graph[u][v] > 0
																												    and visited[v] is False
																												    and distances[v] > distances[u] + self.graph[u][v]
																												):
																																			lowerCAmelCase_       		=  distances[u] + self.graph[u][v]

														self.print_solution(lowercase_     )


if __name__ == "__main__":
		lowerCamelCase_		  =						Graph(9)
		lowerCamelCase_		  =						[
		    [0, 4, 0, 0, 0, 0, 0, 8, 0],
		    [4, 0, 8, 0, 0, 0, 0, 1_1, 0],
		    [0, 8, 0, 7, 0, 4, 0, 0, 2],
		    [0, 0, 7, 0, 9, 1_4, 0, 0, 0],
		    [0, 0, 0, 9, 0, 1_0, 0, 0, 0],
		    [0, 0, 4, 1_4, 1_0, 0, 2, 0, 0],
		    [0, 0, 0, 0, 0, 2, 0, 1, 6],
		    [8, 1_1, 0, 0, 0, 0, 1, 0, 7],
		    [0, 0, 2, 0, 0, 0, 6, 7, 0],
		]
		graph.dijkstra(0)











from __future__ import annotations

from string import ascii_letters
def   lowerCamelCase      (		a_				,		a_				,		a_ = None			)			->    str:
							lowerCAmelCase_       		=  alphabet or ascii_letters

							# The final result string
							lowerCAmelCase_       		=  ''

							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_       		=  (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			)			->    str:
							key *= -1

							return encrypt(a_				,		a_				,		a_			)
def   lowerCamelCase      (		a_				,		a_ = None			)			->    dict[int, str]:
							lowerCAmelCase_       		=  alphabet or ascii_letters

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

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

							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
				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



