




"""simple docstring"""






def 	_snake_case     (							lowercase__						):
				_lowerCamelCase	:     Dict       =       [0] * len(lowercase__						)

				for i in range(1				,       len(lowercase__						)						):
								# use last results for better performance - dynamic programming
								_lowerCamelCase	:     Tuple       =       prefix_result[i - 1]
								while j > 0 and input_string[i] != input_string[j]:
												_lowerCamelCase	:     Tuple       =       prefix_result[j - 1]

								if input_string[i] == input_string[j]:
												j += 1
								_lowerCamelCase	:     Union[str, Any]       =       j

				return prefix_result







def 	_snake_case     (							lowercase__						):
				return max(prefix_function(lowercase__						)						)


if __name__ == "__main__":
			import doctest

			doctest.testmod()





"""simple docstring"""






from __future__ import annotations







def 	_snake_case     (							lowercase__						):  # This function is recursive
				_lowerCamelCase	:     Optional[Any]       =       len(lowercase__						)
				# If the array contains only one element, we return it (it's the stop condition of
				# recursion)
				if array_length <= 1:
								return array
								# Else
				_lowerCamelCase	:     Optional[Any]       =       array[0]
				_lowerCamelCase	:     Optional[int]       =       False
				_lowerCamelCase	:     List[str]       =       1
				_lowerCamelCase	:     list[int]       =       []
				while not is_found and i < array_length:
								if array[i] < pivot:
												_lowerCamelCase	:     Union[str, Any]       =       True
												_lowerCamelCase	:     str       =       [element for element in array[i:] if element >= array[i]]
												_lowerCamelCase	:     str       =       longest_subsequence(lowercase__						)
												if len(lowercase__						) > len(lowercase__						):
																_lowerCamelCase	:     Any       =       temp_array
								else:
												i += 1

				_lowerCamelCase	:     Optional[Any]       =       [element for element in array[1:] if element >= pivot]
				_lowerCamelCase	:     Dict       =       [pivot, *longest_subsequence(lowercase__						)]
				if len(lowercase__						) > len(lowercase__						):
								return temp_array
				else:
								return longest_subseq


if __name__ == "__main__":
			import doctest

			doctest.testmod()