






"""simple docstring"""



def 						lowercase    (				__snake_case				: str		,					__snake_case				: str	):

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

		lowercase_ : Dict							       =   len(__snake_case	)
		lowercase_ : Optional[int]							       =   len(__snake_case	)

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

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

		return texta[ans_index - ans_length : ans_index]


if __name__ == "__main__":
						import doctest

						doctest.testmod()











"""simple docstring"""



from __future__ import annotations

__A		:       List[Any]  				=		[-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0]
__A		:       str  				=		[-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1]



def 						lowercase    (				__snake_case				: list[float]	):
		lowercase_ : List[str]							       =   []
		lowercase_ : List[Any]							       =   len(__snake_case	)

		for i in range(__snake_case	):
				lowercase_ : float							       =   -1
				for j in range(i + 1		,					__snake_case	):
						if arr[i] < arr[j]:
								lowercase_ : List[str]							       =   arr[j]
								break
				result.append(__snake_case	)
		return result



def 						lowercase    (				__snake_case				: list[float]	):
		lowercase_ : List[str]							       =   []
		for i, outer in enumerate(__snake_case	):
				lowercase_ : float							       =   -1
				for inner in arr[i + 1 :]:
						if outer < inner:
								lowercase_ : List[Any]							       =   inner
								break
				result.append(__snake_case	)
		return result



def 						lowercase    (				__snake_case				: list[float]	):
		lowercase_ : List[str]							       =   len(__snake_case	)
		lowercase_ : list[float]							       =   []
		lowercase_ : list[float]							       =   [-1] * arr_size

		for index in reversed(range(__snake_case	)	):
				if stack:
						while stack[-1] <= arr[index]:
								stack.pop()
								if not stack:
										break
				if stack:
						lowercase_ : Optional[Any]							       =   stack[-1]
				stack.append(arr[index]	)
		return result


if __name__ == "__main__":
						from doctest import testmod
						from timeit import timeit

						testmod()
						print(next_greatest_element_slow(arr))
						print(next_greatest_element_fast(arr))
						print(next_greatest_element(arr))

						__A		:       int  				=		(
						    '''from __main__ import arr, next_greatest_element_slow, '''
						    '''next_greatest_element_fast, next_greatest_element'''
						)
						print(
						    '''next_greatest_element_slow():''',
						    timeit('''next_greatest_element_slow(arr)''', setup=setup),
						)
						print(
						    '''next_greatest_element_fast():''',
						    timeit('''next_greatest_element_fast(arr)''', setup=setup),
						)
						print(
						    '''     next_greatest_element():''',
						    timeit('''next_greatest_element(arr)''', setup=setup),
						)



