"""simple docstring"""







from __future__ import annotations


def      __lowerCAmelCase(		__UpperCAmelCase			):  # This function is recursive






	"""simple docstring"""





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

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


if __name__ == "__main__":
						import doctest

						doctest.testmod()




"""simple docstring"""







def      __lowerCAmelCase(		__UpperCAmelCase			):






	"""simple docstring"""





	stooge(__UpperCAmelCase     ,0     ,len(__UpperCAmelCase			) - 1			)
	return arr


def      __lowerCAmelCase(		__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase			):






	"""simple docstring"""





	if i >= h:
		return

	# If first element is smaller than the last then swap them
	if arr[i] > arr[h]:
		_lowercase				,      _lowercase :    List[str]							=							arr[h], arr[i]

	# If there are more than 2 elements in the array
	if h - i + 1 > 2:
		_lowercase :    Optional[int]							=							(int)((h - i + 1) / 3			)

		# Recursively sort first 2/3 elements
		stooge(__UpperCAmelCase     ,__UpperCAmelCase     ,(h - t)			)

		# Recursively sort last 2/3 elements
		stooge(__UpperCAmelCase     ,i + t     ,(__UpperCAmelCase)			)

		# Recursively sort first 2/3 elements
		stooge(__UpperCAmelCase     ,__UpperCAmelCase     ,(h - t)			)


if __name__ == "__main__":
						SCREAMING_SNAKE_CASE									=						input('Enter numbers separated by a comma:\n').strip()
						SCREAMING_SNAKE_CASE									=						[int(item) for item in user_input.split(',')]
						print(stooge_sort(unsorted))



