



'''simple docstring'''




class    A_	:
							"""simple docstring"""




							def __init__(		self			:List[Any]				)				->  Tuple:


										'''simple docstring'''




										snake_case_				:					Any   =       ""
										snake_case_				:					List[Any]   =       ""
										snake_case_				:					Dict   =       []

							def 							_A	(		self			:str       ,							lowerCAmelCase__			:int       ,							lowerCAmelCase__			:int				)				->  int:


										'''simple docstring'''




										if m == -1:
													return n + 1
										elif n == -1:
													return m + 1
										elif self.dp[m][n] > -1:
													return self.dp[m][n]
										else:
													if self.worda[m] == self.worda[n]:
																snake_case_				:					int   =       self.__min_dist_top_down_dp(m - 1       ,							n - 1				)
													else:
																snake_case_				:					Any   =       self.__min_dist_top_down_dp(lowerCAmelCase__       ,							n - 1				)
																snake_case_				:					Optional[Any]   =       self.__min_dist_top_down_dp(m - 1       ,							lowerCAmelCase__				)
																snake_case_				:					Any   =       self.__min_dist_top_down_dp(m - 1       ,							n - 1				)
																snake_case_				:					Union[str, Any]   =       1 + min(lowerCAmelCase__       ,							lowerCAmelCase__       ,							lowerCAmelCase__				)

													return self.dp[m][n]

							def 							_A	(		self			:Any       ,							lowerCAmelCase__			:str       ,							lowerCAmelCase__			:str				)				->  int:


										'''simple docstring'''




										snake_case_				:					int   =       worda
										snake_case_				:					Optional[int]   =       worda
										snake_case_				:					int   =       [[-1 for _ in range(len(lowerCAmelCase__				)				)] for _ in range(len(lowerCAmelCase__				)				)]

										return self.__min_dist_top_down_dp(len(lowerCAmelCase__				) - 1       ,							len(lowerCAmelCase__				) - 1				)






							def 							_A	(		self			:Optional[int]       ,							lowerCAmelCase__			:str       ,							lowerCAmelCase__			:str				)				->  int:


										'''simple docstring'''




										snake_case_				:					List[Any]   =       worda
										snake_case_				:					Optional[int]   =       worda
										snake_case_				:					Union[str, Any]   =       len(lowerCAmelCase__				)
										snake_case_				:					List[str]   =       len(lowerCAmelCase__				)
										snake_case_				:					str   =       [[0 for _ in range(n + 1				)] for _ in range(m + 1				)]

										for i in range(m + 1				):
													for j in range(n + 1				):
																if i == 0:  # first string is empty
																			snake_case_				:					Optional[Any]   =       j
																elif j == 0:  # second string is empty
																			snake_case_				:					List[Any]   =       i
																elif worda[i - 1] == worda[j - 1]:  # last characters are equal
																			snake_case_				:					Optional[int]   =       self.dp[i - 1][j - 1]
																else:
																			snake_case_				:					int   =       self.dp[i][j - 1]
																			snake_case_				:					List[str]   =       self.dp[i - 1][j]
																			snake_case_				:					List[Any]   =       self.dp[i - 1][j - 1]
																			snake_case_				:					Any   =       1 + min(lowerCAmelCase__       ,							lowerCAmelCase__       ,							lowerCAmelCase__				)
										return self.dp[m][n]


if __name__ == "__main__":
		__lowerCamelCase   :					Any   							=					EditDistance()

		print('''****************** Testing Edit Distance DP Algorithm ******************''')
		print()

		__lowerCamelCase   :					Dict   							=					input('''Enter the first string: ''').strip()
		__lowerCamelCase   :					int   							=					input('''Enter the second string: ''').strip()

		print()
		print(f'''The minimum edit distance is: {solver.min_dist_top_down(Sa, Sa)}''')
		print(f'''The minimum edit distance is: {solver.min_dist_bottom_up(Sa, Sa)}''')
		print()
		print('''*************** End of Testing Edit Distance DP Algorithm ***************''')












'''simple docstring'''




def 	__UpperCAmelCase       ( __magic_name__						)->    list[int]:



			"""simple docstring"""



			if length <= 0 or not isinstance(__magic_name__     ,__magic_name__						):
						raise ValueError("Length must be a positive integer."						)
			return [n * (2 * n - 1) for n in range(__magic_name__						)]


if __name__ == "__main__":
		print(hexagonal_numbers(length=5))
		print(hexagonal_numbers(length=10))




