





'''simple docstring'''






class 		UpperCAmelCase   :


  """simple docstring"""







  def __init__(				self    :					Tuple  )     ->						Optional[int]:
    _UpperCamelCase       			=''''''
    _UpperCamelCase       			=''''''
    _UpperCamelCase       			=[]


  def   UpperCamelCase__      (				self    :					Tuple							,	UpperCamelCase__    :					int							,	UpperCamelCase__    :					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]:
        _UpperCamelCase       			=self.__min_dist_top_down_dp(m - 1							,	n - 1  )
      else:
        _UpperCamelCase       			=self.__min_dist_top_down_dp(lowercase_							,	n - 1  )
        _UpperCamelCase       			=self.__min_dist_top_down_dp(m - 1							,	lowercase_  )
        _UpperCamelCase       			=self.__min_dist_top_down_dp(m - 1							,	n - 1  )
        _UpperCamelCase       			=1 + min(lowercase_							,	lowercase_							,	lowercase_  )

      return self.dp[m][n]


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


if __name__ == "__main__":
      __lowerCamelCase						: Optional[int]		=   EditDistance()

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

      __lowerCamelCase						: str		=   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 					_a   (__SCREAMING_SNAKE_CASE   ):


  """simple docstring"""

  return 1 if digit in (0, 1) else (digit * factorial(digit - 1   ))


def 					_a   (__SCREAMING_SNAKE_CASE   ):


  """simple docstring"""

  _UpperCamelCase       			=0
  _UpperCamelCase       			=number
  while duplicate > 0:
    _UpperCamelCase			,     _UpperCamelCase       			=divmod(__SCREAMING_SNAKE_CASE  ,      10   )
    fact_sum += factorial(__SCREAMING_SNAKE_CASE   )
  return fact_sum == number


if __name__ == "__main__":
      print('Program to check whether a number is a Krisnamurthy Number or not.')
      __lowerCamelCase						: Optional[Any]		=   int(input('Enter number: ').strip())
      print(
          F"""{number} is {'' if krishnamurthy(number) else 'not '}a Krishnamurthy Number."""
      )






