
'''simple docstring'''
class       _lowerCAmelCase   :







							'''simple docstring'''

							def __init__(self  ,  UpperCAmelCase  )					->       None:
														_snake_case       =  set_counts
														_snake_case       =  max(UpperCAmelCase  )
														_snake_case       =  len(UpperCAmelCase  )
														_snake_case       =  [1] * num_sets
														_snake_case       =  list(range(UpperCAmelCase  )  )

							def 	lowercase							(self  ,  UpperCAmelCase  ,  UpperCAmelCase  )					->       bool:
														_snake_case       =  self.get_parent(UpperCAmelCase  )
														_snake_case       =  self.get_parent(UpperCAmelCase  )

														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]
																					_snake_case       =  0
																					_snake_case       =  dst_parent
																					if self.ranks[dst_parent] == self.ranks[src_parent]:
																												self.ranks[dst_parent] += 1
																					_snake_case       =  self.set_counts[dst_parent]
														else:
																					self.set_counts[src_parent] += self.set_counts[dst_parent]
																					_snake_case       =  0
																					_snake_case       =  src_parent
																					_snake_case       =  self.set_counts[src_parent]

														_snake_case       =  max(self.max_set  ,  UpperCAmelCase  )
														return True





							def 	lowercase							(self  ,  UpperCAmelCase  )					->       int:
														if self.parents[disj_set] == disj_set:
																					return disj_set
														_snake_case       =  self.get_parent(self.parents[disj_set]  )
														return self.parents[disj_set]

'''simple docstring'''
def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE							, _SCREAMING_SNAKE_CASE				):

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

							_snake_case       =  len(_SCREAMING_SNAKE_CASE				)
							_snake_case       =  len(_SCREAMING_SNAKE_CASE				)

							_snake_case       =  [[0] * (texta_length + 1) for _ in range(texta_length + 1				)]
							_snake_case       =  0
							_snake_case       =  0

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

							return texta[ans_index - ans_length : ans_index]


if __name__ == "__main__":
				import doctest

				doctest.testmod()