



"""simple docstring"""
from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


__SCREAMING_SNAKE_CASE     :  Any										=					{
    '''configuration_donut_swin''': ['''DONUT_SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''DonutSwinConfig'''],
    '''processing_donut''': ['''DonutProcessor'''],
}

try:
			if not is_torch_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			__SCREAMING_SNAKE_CASE     :  List[str]										=					[
			    '''DONUT_SWIN_PRETRAINED_MODEL_ARCHIVE_LIST''',
			    '''DonutSwinModel''',
			    '''DonutSwinPreTrainedModel''',
			]

try:
			if not is_vision_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			__SCREAMING_SNAKE_CASE     :  List[str]										=					['''DonutFeatureExtractor''']
			__SCREAMING_SNAKE_CASE     :  int										=					['''DonutImageProcessor''']


if TYPE_CHECKING:
			from .configuration_donut_swin import DONUT_SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP, DonutSwinConfig
			from .processing_donut import DonutProcessor

			try:
						if not is_torch_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_donut_swin import (
						    DONUT_SWIN_PRETRAINED_MODEL_ARCHIVE_LIST,
						    DonutSwinModel,
						    DonutSwinPreTrainedModel,
						)

			try:
						if not is_vision_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .feature_extraction_donut import DonutFeatureExtractor
						from .image_processing_donut import DonutImageProcessor

else:
			import sys

			__SCREAMING_SNAKE_CASE     :  List[Any]										=					_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





"""simple docstring"""
def 				lowerCAmelCase_(      lowercase_   :							str  ,      lowercase_   :							str							)		->				int:
				# The longer word should come first
				if len(lowercase_							) < len(lowercase_							):
								return levenshtein_distance(lowercase_  ,      lowercase_							)

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

				_lowerCamelCase					     = list(range(len(lowercase_							) + 1							)							)

				for i, ca in enumerate(lowercase_							):
								_lowerCamelCase					     = [i + 1]

								for j, ca in enumerate(lowercase_							):
												# Calculate insertions, deletions and substitutions
												_lowerCamelCase					     = previous_row[j + 1] + 1
												_lowerCamelCase					     = current_row[j] + 1
												_lowerCamelCase					     = previous_row[j] + (ca != ca)

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

								# Store the previous row
								_lowerCamelCase					     = current_row

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


if __name__ == "__main__":
			__SCREAMING_SNAKE_CASE     :  int										=					input('''Enter the first word:\n''').strip()
			__SCREAMING_SNAKE_CASE     :  Optional[Any]										=					input('''Enter the second word:\n''').strip()

			__SCREAMING_SNAKE_CASE     :  Optional[Any]										=					levenshtein_distance(first_word, second_word)
			print(F"""Levenshtein distance between {first_word} and {second_word} is {result}""")
