





from dataclasses import dataclass
from typing import Callable, Optional

import datasets



@dataclass
class 				_lowerCAmelCase			(	datasets.BuilderConfig							):


  '''simple docstring'''
  a_							:				Optional[Callable]					    =None
  a_							:				Optional[dict]					    =None
  a_							:				Optional[datasets.Features]					    =None







  def UpperCamelCase_       (					self					:    Tuple							):


    '''simple docstring'''





    assert self.generator is not None, "generator must be specified"

    if self.gen_kwargs is None:
      _snake_case      : Optional[int]														=		{}




class 				_lowerCAmelCase			(	datasets.GeneratorBasedBuilder							):


  '''simple docstring'''
  a_							:				Optional[int]					    =GeneratorConfig







  def UpperCamelCase_       (					self					:    Union[str, Any]							):


    '''simple docstring'''





    return datasets.DatasetInfo(features=self.config.features							)







  def UpperCamelCase_       (					self					:    List[Any]					, UpperCamelCase					:    Union[str, Any]							):


    '''simple docstring'''





    return [datasets.SplitGenerator(name=datasets.Split.TRAIN					, gen_kwargs=self.config.gen_kwargs							)]







  def UpperCamelCase_       (					self					:    Tuple					, **UpperCamelCase					:    int							):


    '''simple docstring'''





    for idx, ex in enumerate(self.config.generator(**UpperCamelCase							)							):
      yield idx, ex











def 			lowerCamelCase_		(					lowerCAmelCase:		str			,							lowerCAmelCase:		str )->						int:
  # The longer word should come first
  if len(lowerCAmelCase ) < len(lowerCAmelCase ):
    return levenshtein_distance(lowerCAmelCase			,							lowerCAmelCase )

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

  _snake_case      : Dict														=		list(range(len(lowerCAmelCase ) + 1 ) )

  for i, ca in enumerate(lowerCAmelCase ):
    _snake_case      : Optional[int]														=		[i + 1]

    for j, ca in enumerate(lowerCAmelCase ):
      # Calculate insertions, deletions and substitutions
      _snake_case      : Optional[Any]														=		previous_row[j + 1] + 1
      _snake_case      : Optional[int]														=		current_row[j] + 1
      _snake_case      : Union[str, Any]														=		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
    _snake_case      : str														=		current_row

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


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

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




