






'''simple docstring'''
class        __SCREAMING_SNAKE_CASE :




 def __init__( self		:							Optional[int] )		->  Optional[Any]:
       SCREAMING_SNAKE_CASE__       :			Dict													=''''''
       SCREAMING_SNAKE_CASE__       :			Dict													=''''''
       SCREAMING_SNAKE_CASE__       :			List[Any]													=[]




 def        __magic_name__		( self		:							List[Any]   , __lowercase		:							int   , __lowercase		:							int )		->  int:
       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]:
                   SCREAMING_SNAKE_CASE__       :			Tuple													=self.__min_dist_top_down_dp(m - 1   , n - 1 )
             else:
                   SCREAMING_SNAKE_CASE__       :			Union[str, Any]													=self.__min_dist_top_down_dp(__lowercase   , n - 1 )
                   SCREAMING_SNAKE_CASE__       :			List[str]													=self.__min_dist_top_down_dp(m - 1   , __lowercase )
                   SCREAMING_SNAKE_CASE__       :			Dict													=self.__min_dist_top_down_dp(m - 1   , n - 1 )
                   SCREAMING_SNAKE_CASE__       :			Union[str, Any]													=1 + min(__lowercase   , __lowercase   , __lowercase )

             return self.dp[m][n]




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


if __name__ == "__main__":
  a_					=	EditDistance()

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

  a_					=	input('Enter the first string: ').strip()
  a_					=	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'''
from __future__ import annotations





def 	_a(					UpperCamelCase__			:  List[str],		UpperCamelCase__			:  Union[str, Any],		UpperCamelCase__			:  int,		UpperCamelCase__			:  List[str]							):  # noqa: E741




      '''simple docstring'''






      while r - l > 1:
            SCREAMING_SNAKE_CASE__       :			List[str]													=(l + r) // 2
            if v[m] >= key:
                  SCREAMING_SNAKE_CASE__       :			Dict													=m
            else:
                  SCREAMING_SNAKE_CASE__       :			Any													=m  # noqa: E741
      return r





def 	_a(					UpperCamelCase__			:  list[int]							):




      '''simple docstring'''






      if len(UpperCamelCase__							) == 0:
            return 0

      SCREAMING_SNAKE_CASE__       :			List[Any]													=[0] * len(UpperCamelCase__							)
      SCREAMING_SNAKE_CASE__       :			Dict													=1

      SCREAMING_SNAKE_CASE__       :			Union[str, Any]													=v[0]

      for i in range(1,		len(UpperCamelCase__							)							):
            if v[i] < tail[0]:
                  SCREAMING_SNAKE_CASE__       :			List[Any]													=v[i]
            elif v[i] > tail[length - 1]:
                  SCREAMING_SNAKE_CASE__       :			int													=v[i]
                  length += 1
            else:
                  SCREAMING_SNAKE_CASE__       :			Union[str, Any]													=v[i]

      return length


if __name__ == "__main__":
  import doctest

  doctest.testmod()