

"""simple docstring"""





from __future__ import annotations







class 							SCREAMING_SNAKE_CASE   :






					"""simple docstring"""



					def __init__(			self     :							Optional[Any]  ,lowercase_     :							int = 0						):
						lowerCAmelCase__      :		Any    							=      key







					def 			__lowerCAmelCase					(			self     :							Tuple  ,lowercase_     :							str  ,lowercase_     :							int						):
						assert isinstance(lowercase_  ,lowercase_						) and isinstance(lowercase_  ,lowercase_						)

						lowerCAmelCase__      :		str    							=      key or self.__key or 1

						# make sure key is an appropriate size
						key %= 2_5_5

						return [chr(ord(lowercase_						) ^ key						) for ch in content]







					def 			__lowerCAmelCase					(			self     :							List[str]  ,lowercase_     :							str  ,lowercase_     :							int						):
						assert isinstance(lowercase_  ,lowercase_						) and isinstance(lowercase_  ,lowercase_						)

						lowerCAmelCase__      :		Optional[int]    							=      key or self.__key or 1

						# make sure key is an appropriate size
						key %= 2_5_5

						return [chr(ord(lowercase_						) ^ key						) for ch in content]







					def 			__lowerCAmelCase					(			self     :							str  ,lowercase_     :							str  ,lowercase_     :							int = 0						):
						assert isinstance(lowercase_  ,lowercase_						) and isinstance(lowercase_  ,lowercase_						)

						lowerCAmelCase__      :		List[Any]    							=      key or self.__key or 1

						# make sure key can be any size
						while key > 2_5_5:
							key -= 2_5_5

						# This will be returned
						lowerCAmelCase__      :		Optional[int]    							=      ''''''

						for ch in content:
							ans += chr(ord(lowercase_						) ^ key						)

						return ans







					def 			__lowerCAmelCase					(			self     :							List[Any]  ,lowercase_     :							str  ,lowercase_     :							int = 0						):
						assert isinstance(lowercase_  ,lowercase_						) and isinstance(lowercase_  ,lowercase_						)

						lowerCAmelCase__      :		Dict    							=      key or self.__key or 1

						# make sure key can be any size
						while key > 2_5_5:
							key -= 2_5_5

						# This will be returned
						lowerCAmelCase__      :		Optional[Any]    							=      ''''''

						for ch in content:
							ans += chr(ord(lowercase_						) ^ key						)

						return ans







					def 			__lowerCAmelCase					(			self     :							Tuple  ,lowercase_     :							str  ,lowercase_     :							int = 0						):
						assert isinstance(lowercase_  ,lowercase_						) and isinstance(lowercase_  ,lowercase_						)

						try:
							with open(lowercase_						) as fin, open('''encrypt.out'''  ,'''w+'''						) as fout:
								# actual encrypt-process
								for line in fin:
									fout.write(self.encrypt_string(lowercase_  ,lowercase_						)						)

						except OSError:
							return False

						return True







					def 			__lowerCAmelCase					(			self     :							int  ,lowercase_     :							str  ,lowercase_     :							int						):
						assert isinstance(lowercase_  ,lowercase_						) and isinstance(lowercase_  ,lowercase_						)

						try:
							with open(lowercase_						) as fin, open('''decrypt.out'''  ,'''w+'''						) as fout:
								# actual encrypt-process
								for line in fin:
									fout.write(self.decrypt_string(lowercase_  ,lowercase_						)						)

						except OSError:
							return False

						return True


# Tests
# crypt = XORCipher()
# key = 67

# # test encrypt
# print(crypt.encrypt("hallo welt",key))
# # test decrypt
# print(crypt.decrypt(crypt.encrypt("hallo welt",key), key))

# # test encrypt_string
# print(crypt.encrypt_string("hallo welt",key))

# # test decrypt_string
# print(crypt.decrypt_string(crypt.encrypt_string("hallo welt",key),key))

# if (crypt.encrypt_file("test.txt",key)):
#       print("encrypt successful")
# else:
#       print("encrypt unsuccessful")

# if (crypt.decrypt_file("encrypt.out",key)):
#       print("decrypt successful")
# else:
#       print("decrypt unsuccessful")







"""simple docstring"""





def     __SCREAMING_SNAKE_CASE    ( A_					):
	for i in range(len(A_					) - 1		,	0		,	-1					):
		lowerCAmelCase__      :		Optional[Any]    							=      False

		for j in range(A_		,	0		,	-1					):
			if unsorted[j] < unsorted[j - 1]:
				lowerCAmelCase__							,lowerCAmelCase__      :		Union[str, Any]    							=      unsorted[j - 1], unsorted[j]
				lowerCAmelCase__      :		Dict    							=      True

		for j in range(A_					):
			if unsorted[j] > unsorted[j + 1]:
				lowerCAmelCase__							,lowerCAmelCase__      :		Union[str, Any]    							=      unsorted[j + 1], unsorted[j]
				lowerCAmelCase__      :		Any    							=      True

		if not swapped:
			break
	return unsorted


if __name__ == "__main__":
							import doctest

							doctest.testmod()
							__UpperCamelCase    : int				 =						input('''Enter numbers separated by a comma:\n''').strip()
							__UpperCamelCase    : Optional[Any]				 =						[int(item) for item in user_input.split(''',''')]
							print(F'''{cocktail_shaker_sort(unsorted) = }''')




