






'''simple docstring'''

class 							__magic_name__     :







	"""simple docstring"""



	def __init__(							self       )						->  Optional[Any]:
							lowercase_      :   Any        =			""""""
							lowercase_      :   List[str]        =			""""""
							lowercase_      :   List[Any]        =			[]
	def        lowerCamelCase__		(							self  ,      _lowercase  ,      _lowercase       )						->  Any:
							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]:
																			lowercase_      :   int        =			self.__min_dist_top_down_dp(m - 1  ,      n - 1       )
													else:
																			lowercase_      :   Tuple        =			self.__min_dist_top_down_dp(_lowercase  ,      n - 1       )
																			lowercase_      :   str        =			self.__min_dist_top_down_dp(m - 1  ,      _lowercase       )
																			lowercase_      :   List[Any]        =			self.__min_dist_top_down_dp(m - 1  ,      n - 1       )
																			lowercase_      :   Optional[int]        =			1 + min(_lowercase  ,      _lowercase  ,      _lowercase       )

													return self.dp[m][n]
	def        lowerCamelCase__		(							self  ,      _lowercase  ,      _lowercase       )						->  Any:
							lowercase_      :   List[Any]        =			worda
							lowercase_      :   int        =			worda
							lowercase_      :   str        =			[[-1 for _ in range(len(_lowercase       )       )] for _ in range(len(_lowercase       )       )]

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







	def        lowerCamelCase__		(							self  ,      _lowercase  ,      _lowercase       )						->  Dict:
							lowercase_      :   str        =			worda
							lowercase_      :   Any        =			worda
							lowercase_      :   str        =			len(_lowercase       )
							lowercase_      :   Tuple        =			len(_lowercase       )
							lowercase_      :   Union[str, Any]        =			[[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
																									lowercase_      :   List[Any]        =			j
																			elif j == 0:  # second string is empty
																									lowercase_      :   List[Any]        =			i
																			elif worda[i - 1] == worda[j - 1]:  # last characters are equal
																									lowercase_      :   List[Any]        =			self.dp[i - 1][j - 1]
																			else:
																									lowercase_      :   int        =			self.dp[i][j - 1]
																									lowercase_      :   List[Any]        =			self.dp[i - 1][j]
																									lowercase_      :   Union[str, Any]        =			self.dp[i - 1][j - 1]
																									lowercase_      :   List[Any]        =			1 + min(_lowercase  ,      _lowercase  ,      _lowercase       )
							return self.dp[m][n]


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

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

						A:      Dict  				=				input("Enter the first string: ").strip()
						A:      List[Any]  				=				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    (  a		:	str							)			->			str:





						"""simple docstring"""
						lowercase_      :   Dict        =			0

						# if input_string is "aba" than new_input_string become "a|b|a"
						lowercase_      :   Dict        =			''
						lowercase_      :   Any        =			''

						# append each character + "|" in new_string for range(0, length-1)
						for i in input_string[: len(a							) - 1]:
												new_input_string += i + "|"
						# append last character
						new_input_string += input_string[-1]

						# we will store the starting and ending of previous furthest ending palindromic
						# substring
						lowercase_  ,      lowercase_      :   Dict        =			0, 0

						# length[i] shows the length of palindromic substring with center i
						lowercase_      :   List[Any]        =			[1 for i in range(len(a							)							)]

						# for each character in new_string find corresponding palindromic string
						lowercase_      :   Dict        =			0
						for j in range(len(a							)							):
												lowercase_      :   Tuple        =			1 if j > r else min(length[l + r - j] // 2						,			r - j + 1							)
												while (
												    j - k >= 0
												    and j + k < len(a							)
												    and new_input_string[k + j] == new_input_string[j - k]
												):
																		k += 1

												lowercase_      :   int        =			2 * k - 1

												# does this string is ending after the previously explored end (that is r) ?
												# if yes the update the new r to the last index of this
												if j + k - 1 > r:
																		lowercase_      :   Tuple        =			j - k + 1  # noqa: E741
																		lowercase_      :   Tuple        =			j + k - 1

												# update max_length and start position
												if max_length < length[j]:
																		lowercase_      :   Tuple        =			length[j]
																		lowercase_      :   List[Any]        =			j

    # create that string
						lowercase_      :   str        =			new_input_string[start - max_length // 2 : start + max_length // 2 + 1]
						for i in s:
												if i != "|":
																		output_string += i

						return output_string


if __name__ == "__main__":
						import doctest

						doctest.testmod()
