
"""simple docstring"""







def    __lowerCAmelCase    (_UpperCamelCase		):
	__lowerCAmelCase      :						str						      =				len(_UpperCamelCase		)
	while cur > 1:
		# Find the maximum number in arr
		__lowerCAmelCase      :						Dict						      =				arr.index(max(arr[0:cur]		)		)
		# Reverse from 0 to mi
		__lowerCAmelCase      :						Optional[Any]						      =				arr[mi::-1] + arr[mi + 1 : len(_UpperCamelCase		)]
		# Reverse whole list
		__lowerCAmelCase      :						Dict						      =				arr[cur - 1 :: -1] + arr[cur : len(_UpperCamelCase		)]
		cur -= 1
	return arr


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

"""simple docstring"""







class 			A__	:

		def __init__(				self	,		_SCREAMING_SNAKE_CASE			):
			__lowerCAmelCase      :						List[Any]						      =				size
			__lowerCAmelCase      :						str						      =				[0] * size
			__lowerCAmelCase      :						Any						      =				[0] * size

		@staticmethod
		def 							__lowerCamelCase							(				_SCREAMING_SNAKE_CASE			):
			return index | (index + 1)

		@staticmethod
		def 							__lowerCamelCase							(				_SCREAMING_SNAKE_CASE			):
			return (index & (index + 1)) - 1

		def 							__lowerCamelCase							(				self	,		_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE			):
			__lowerCAmelCase      :						Any						      =				value
			while index < self.size:
				__lowerCAmelCase      :						Dict						      =				self.get_prev(_SCREAMING_SNAKE_CASE			) + 1
				if current_left_border == index:
					__lowerCAmelCase      :						Any						      =				value
				else:
					__lowerCAmelCase      :						Any						      =				max(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE			)
				__lowerCAmelCase      :						List[Any]						      =				self.get_next(_SCREAMING_SNAKE_CASE			)







		def 							__lowerCamelCase							(				self	,		_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE			):
			right -= 1  # Because of right is exclusive
			__lowerCAmelCase      :						Optional[int]						      =				0
			while left <= right:
				__lowerCAmelCase      :						Optional[int]						      =				self.get_prev(_SCREAMING_SNAKE_CASE			)
				if left <= current_left:
					__lowerCAmelCase      :						Optional[Any]						      =				max(_SCREAMING_SNAKE_CASE	,		self.tree[right]			)
					__lowerCAmelCase      :						Optional[Any]						      =				current_left
				else:
					__lowerCAmelCase      :						List[str]						      =				max(_SCREAMING_SNAKE_CASE	,		self.arr[right]			)
					right -= 1
			return result


if __name__ == "__main__":
							import doctest

							doctest.testmod()