






def 							A     (       a_							,a_					)     ->						str:

					if not (isinstance(a_							,a_					) and isinstance(a_							,a_					)):
										raise ValueError('longest_common_substring() takes two strings for inputs'					)

					__UpperCamelCase      :					str       		=len(a_					)
					__UpperCamelCase      :					Dict       		=len(a_					)

					__UpperCamelCase      :					Union[str, Any]       		=[[0] * (texta_length + 1) for _ in range(texta_length + 1					)]
					__UpperCamelCase      :					Dict       		=0
					__UpperCamelCase      :					Dict       		=0

					for i in range(1							,texta_length + 1					):
										for j in range(1							,texta_length + 1					):
															if texta[i - 1] == texta[j - 1]:
																				__UpperCamelCase      :					Any       		=1 + dp[i - 1][j - 1]
																				if dp[i][j] > ans_length:
																									__UpperCamelCase      :					Dict       		=i
																									__UpperCamelCase      :					Optional[Any]       		=dp[i][j]

					return texta[ans_index - ans_length : ans_index]


if __name__ == "__main__":
							import doctest

							doctest.testmod()








class 					A__   :





      def __init__( self       ,							A_   ):
       '''simple docstring'''




       UpperCamelCase	:					Union[str, Any]       	=   set_counts
       UpperCamelCase	:					int       	=   max(A_   )
       UpperCamelCase	:					Optional[Any]       	=   len(A_   )
       UpperCamelCase	:					Union[str, Any]       	=   [1] * num_sets
       UpperCamelCase	:					Union[str, Any]       	=   list(range(A_   )   )





      def        __UpperCamelCase( self       ,							A_       ,							A_   ):
       '''simple docstring'''




       UpperCamelCase	:					Any       	=   self.get_parent(A_   )
       UpperCamelCase	:					Optional[int]       	=   self.get_parent(A_   )

       if src_parent == dst_parent:
        return False

       if self.ranks[dst_parent] >= self.ranks[src_parent]:
        self.set_counts[dst_parent] += self.set_counts[src_parent]
        UpperCamelCase	:					int       	=   0
        UpperCamelCase	:					Dict       	=   dst_parent
        if self.ranks[dst_parent] == self.ranks[src_parent]:
         self.ranks[dst_parent] += 1
        UpperCamelCase	:					Optional[int]       	=   self.set_counts[dst_parent]
       else:
        self.set_counts[src_parent] += self.set_counts[dst_parent]
        UpperCamelCase	:					Any       	=   0
        UpperCamelCase	:					Optional[int]       	=   src_parent
        UpperCamelCase	:					int       	=   self.set_counts[src_parent]

       UpperCamelCase	:					Any       	=   max(self.max_set       ,							A_   )
       return True





      def        __UpperCamelCase( self       ,							A_   ):
       '''simple docstring'''




       if self.parents[disj_set] == disj_set:
        return disj_set
       UpperCamelCase	:					Optional[int]       	=   self.get_parent(self.parents[disj_set]   )
       return self.parents[disj_set]
