




'''simple docstring'''



UpperCAmelCase_							:	Union[str, Any]	     =		{0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []}

UpperCAmelCase_							:	str	     =		{0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]}







def       _UpperCamelCase			(_lowerCamelCase				:  dict[int, list[int]] ,						_lowerCamelCase				:  int ,						_lowerCamelCase				:  list[bool]						)-> list[int]:




     '''simple docstring'''





     __snake_case            =	True
     __snake_case            =	[]

     for neighbour in graph[vert]:
          if not visited[neighbour]:
               order += topology_sort(_lowerCamelCase ,						_lowerCamelCase ,						_lowerCamelCase						)

     order.append(_lowerCamelCase						)

     return order







def       _UpperCamelCase			(_lowerCamelCase				:  dict[int, list[int]] ,						_lowerCamelCase				:  int ,						_lowerCamelCase				:  list[bool]						)-> list[int]:




     '''simple docstring'''





     __snake_case            =	True
     __snake_case            =	[vert]

     for neighbour in reversed_graph[vert]:
          if not visited[neighbour]:
               component += find_components(_lowerCamelCase ,						_lowerCamelCase ,						_lowerCamelCase						)

     return component







def       _UpperCamelCase			(_lowerCamelCase				:  dict[int, list[int]]						)-> list[list[int]]:




     '''simple docstring'''





     __snake_case            =	len(_lowerCamelCase						) * [False]
     __snake_case            =	{vert: [] for vert in range(len(_lowerCamelCase						)						)}

     for vert, neighbours in graph.items():
          for neighbour in neighbours:
               reversed_graph[neighbour].append(_lowerCamelCase						)

     __snake_case            =	[]
     for i, was_visited in enumerate(_lowerCamelCase						):
          if not was_visited:
               order += topology_sort(_lowerCamelCase ,						_lowerCamelCase ,						_lowerCamelCase						)

     __snake_case            =	[]
     __snake_case            =	len(_lowerCamelCase						) * [False]

     for i in range(len(_lowerCamelCase						)						):
          __snake_case            =	order[len(_lowerCamelCase						) - i - 1]
          if not visited[vert]:
               __snake_case            =	find_components(_lowerCamelCase ,						_lowerCamelCase ,						_lowerCamelCase						)
               components_list.append(_lowerCamelCase						)

     return components_list










def 							UpperCamelCase_( lowerCamelCase_					)       ->		int:

    if not isinstance(lowerCamelCase_				,					lowerCamelCase_					):
        raise ValueError('multiplicative_persistence() only accepts integral values'					)
    if num < 0:
        raise ValueError('multiplicative_persistence() does not accept negative values'					)

    _lowercase			:				List[str] 						=						0
    _lowercase			:				Optional[int] 						=						str(lowerCamelCase_					)

    while len(lowerCamelCase_					) != 1:
        _lowercase			:				Any 						=						[int(lowerCamelCase_					) for i in num_string]

        _lowercase			:				List[Any] 						=						1
        for i in range(0				,					len(lowerCamelCase_					)					):
            total *= numbers[i]

        _lowercase			:				Optional[Any] 						=						str(lowerCamelCase_					)

        steps += 1
    return steps



def 							UpperCamelCase_( lowerCamelCase_					)       ->		int:

    if not isinstance(lowerCamelCase_				,					lowerCamelCase_					):
        raise ValueError('additive_persistence() only accepts integral values'					)
    if num < 0:
        raise ValueError('additive_persistence() does not accept negative values'					)

    _lowercase			:				Optional[int] 						=						0
    _lowercase			:				str 						=						str(lowerCamelCase_					)

    while len(lowerCamelCase_					) != 1:
        _lowercase			:				Dict 						=						[int(lowerCamelCase_					) for i in num_string]

        _lowercase			:				Any 						=						0
        for i in range(0				,					len(lowerCamelCase_					)					):
            total += numbers[i]

        _lowercase			:				Dict 						=						str(lowerCamelCase_					)

        steps += 1
    return steps


if __name__ == "__main__":
 import doctest

 doctest.testmod()


