

'''simple docstring'''




from __future__ import annotations




def 						UpperCamelCase	(			a		,						a			)				->     set[str]:






     '''simple docstring'''
     __magic_name__       ,  __magic_name__						       =    set(a			), [start]

     while stack:
          __magic_name__						       =    stack.pop()
          explored.add(a			)
          # Differences from BFS:
          # 1) pop last element instead of first one
          # 2) add adjacent elements to stack without exploring them
          for adj in reversed(graph[v]			):
               if adj not in explored:
                    stack.append(a			)
     return explored


_lowerCAmelCase         =						{
    "A": ["B", "C", "D"],
    "B": ["A", "D", "E"],
    "C": ["A", "F"],
    "D": ["B", "D"],
    "E": ["B", "F"],
    "F": ["C", "E", "G"],
    "G": ["F"],
}

if __name__ == "__main__":
      import doctest

      doctest.testmod()
      print(depth_first_search(G, "A"))









'''simple docstring'''




import functools




def 						UpperCamelCase	(			a		,						a			)				->     int:






     '''simple docstring'''
     __magic_name__						       =    len(a			)
     __magic_name__						       =    len(a			)

     @functools.cache
     def min_distance(a		,						a			) -> int:
          # if first word index is overflow - delete all from the second word
          if indexa >= len_worda:
               return len_worda - indexa
          # if second word index is overflow - delete all from the first word
          if indexa >= len_worda:
               return len_worda - indexa
          __magic_name__						       =    int(worda[indexa] != worda[indexa]			)  # current letters not identical
          return min(
              1 + min_distance(indexa + 1		,						a			)		,						1 + min_distance(a		,						indexa + 1			)		,						diff + min_distance(indexa + 1		,						indexa + 1			)		,						)

     return min_distance(0		,						0			)


if __name__ == "__main__":
      import doctest

      doctest.testmod()






