"""simple docstring"""



def    _A(		lowerCAmelCase ,     lowerCAmelCase       ):



							if len(lowerCAmelCase       ) < len(lowerCAmelCase       ):
														return levenshtein_distance(lowerCAmelCase ,     lowerCAmelCase       )

							if len(lowerCAmelCase       ) == 0:
														return len(lowerCAmelCase       )

							A__					:    List[Any]														= list(range(len(lowerCAmelCase       ) + 1       )       )

							for i, ca in enumerate(lowerCAmelCase       ):
														A__					:    Dict														= [i + 1]

														for j, ca in enumerate(lowerCAmelCase       ):
																					# Calculate insertions, deletions and substitutions
																					A__					:    Dict														= previous_row[j + 1] + 1
																					A__					:    Tuple														= current_row[j] + 1
																					A__					:    int														= previous_row[j] + (ca != ca)

																					# Get the minimum to append to the current row
																					current_row.append(min(lowerCAmelCase ,     lowerCAmelCase ,     lowerCAmelCase       )       )

														# Store the previous row
														A__					:    str														= current_row

							# Returns the last element (distance)
							return previous_row[-1]


if __name__ == "__main__":
					_UpperCamelCase         =		input("Enter the first word:\n").strip()
					_UpperCamelCase         =		input("Enter the second word:\n").strip()

					_UpperCamelCase         =		levenshtein_distance(first_word, second_word)
					print(F'Levenshtein distance between {first_word} and {second_word} is {result}')






"""simple docstring"""



from __future__ import annotations

import random
from collections.abc import Iterable
from typing import Any, Generic, TypeVar

_UpperCamelCase         =		TypeVar("T", bound=bool)
class 	__UpperCAmelCase						(Generic[T]    ):







			'''simple docstring'''





			def __init__( self      ,			snake_case_       ):







										'''simple docstring'''


										A__					:    T														= value
										A__					:    RandomizedHeapNode[T] | None														= None
										A__					:    RandomizedHeapNode[T] | None														= None





			@property
			def 		lowerCamelCase				( self       ):







										'''simple docstring'''


										return self._value





			@staticmethod
			def 		lowerCamelCase				( snake_case_      ,			snake_case_       ):







										'''simple docstring'''


										if not roota:
																	return roota

										if not roota:
																	return roota

										if roota.value > roota.value:
																	A__							,       A__					:    Union[str, Any]														= roota, roota

										if random.choice([True, False]       ):
																	A__							,       A__					:    Any														= roota.right, roota.left

										A__					:    Dict														= RandomizedHeapNode.merge(roota.left      ,			snake_case_       )

										return roota





class 	__UpperCAmelCase						(Generic[T]    ):







			'''simple docstring'''





			def __init__( self      ,			snake_case_ = ()       ):







										'''simple docstring'''


										A__					:    RandomizedHeapNode[T] | None														= None

										if data:
																	for item in data:
																								self.insert(snake_case_       )





			def 		lowerCamelCase				( self      ,			snake_case_       ):







										'''simple docstring'''


										A__					:    Dict														= RandomizedHeapNode.merge(self._root      ,			RandomizedHeapNode(snake_case_       )       )





			def 		lowerCamelCase				( self       ):







										'''simple docstring'''


										A__					:    List[str]														= self.top()

										if self._root is None:
																	return None

										A__					:    str														= RandomizedHeapNode.merge(self._root.left      ,			self._root.right       )

										return result





			def 		lowerCamelCase				( self       ):







										'''simple docstring'''


										if not self._root:
																	raise IndexError("""Can't get top element for the empty heap."""       )
										return self._root.value





			def 		lowerCamelCase				( self       ):







										'''simple docstring'''


										A__					:    List[Any]														= None





			def 		lowerCamelCase				( self       ):







										'''simple docstring'''


										A__					:    int														= []
										while self:
																	result.append(self.pop()       )

										return result





			def __bool__( self       ):







										'''simple docstring'''


										return self._root is not None


if __name__ == "__main__":
				import doctest

				doctest.testmod()





