
from __future__ import annotations


def    a      ( a		,						a	)     ->bool:




			'''simple docstring'''


			SCREAMING_SNAKE_CASE     						= get_failure_array(a	)

			# 2) Step through text searching for pattern
			SCREAMING_SNAKE_CASE						,							SCREAMING_SNAKE_CASE     						= 0, 0  # index into text, pattern
			while i < len(a	):
						if pattern[j] == text[i]:
									if j == (len(a	) - 1):
												return True
									j += 1

						# if this is a prefix in our pattern
						# just go back far enough to continue
						elif j > 0:
									SCREAMING_SNAKE_CASE     						= failure[j - 1]
									continue
						i += 1
			return False


def    a      ( a	)     ->list[int]:




			'''simple docstring'''


			SCREAMING_SNAKE_CASE     						= [0]
			SCREAMING_SNAKE_CASE     						= 0
			SCREAMING_SNAKE_CASE     						= 1
			while j < len(a	):
						if pattern[i] == pattern[j]:
									i += 1
						elif i > 0:
									SCREAMING_SNAKE_CASE     						= failure[i - 1]
									continue
						j += 1
						failure.append(a	)
			return failure


if __name__ == "__main__":
							# Test 1)
							__lowerCAmelCase					   =       'abc1abc12'
							__lowerCAmelCase					   =       'alskfjaldsabc1abc1abc12k23adsfabcabc'
							__lowerCAmelCase					   =       'alskfjaldsk23adsfabcabc'
							assert kmp(pattern, texta) and not kmp(pattern, texta)

							# Test 2)
							__lowerCAmelCase					   =       'ABABX'
							__lowerCAmelCase					   =       'ABABZABABYABABX'
							assert kmp(pattern, text)

							# Test 3)
							__lowerCAmelCase					   =       'AAAB'
							__lowerCAmelCase					   =       'ABAAAAAB'
							assert kmp(pattern, text)

							# Test 4)
							__lowerCAmelCase					   =       'abcdabcy'
							__lowerCAmelCase					   =       'abcxabcdabxabcdabcdabcy'
							assert kmp(pattern, text)

							# Test 5)
							__lowerCAmelCase					   =       'aabaabaaa'
							assert get_failure_array(pattern) == [0, 1, 0, 1, 2, 3, 4, 5, 2]

def    a      ( a	)     ->List[Any]:




			'''simple docstring'''


			SCREAMING_SNAKE_CASE     						= len(a	)
			while cur > 1:
						# Find the maximum number in arr
						SCREAMING_SNAKE_CASE     						= arr.index(max(arr[0:cur]	)	)
						# Reverse from 0 to mi
						SCREAMING_SNAKE_CASE     						= arr[mi::-1] + arr[mi + 1 : len(a	)]
						# Reverse whole list
						SCREAMING_SNAKE_CASE     						= arr[cur - 1 :: -1] + arr[cur : len(a	)]
						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))