


'''simple docstring'''
def      __snake_case       (       lowerCamelCase_ :				list[int]						):
				'''simple docstring'''




				if len(lowerCamelCase_						) == 1:
								return a[0], a[0]
				else:
								# split A into half.
								__magic_name__	  = a[: len(lowerCamelCase_						) // 2]
								__magic_name__	  = a[len(lowerCamelCase_						) // 2 :]

								# 2 sub problems, 1/2 of original size.
								__magic_name__  ,      __magic_name__	  = max_difference(lowerCamelCase_						)
								__magic_name__  ,      __magic_name__	  = max_difference(lowerCamelCase_						)

								# get min of first and max of second
								# linear time
								__magic_name__	  = min(lowerCamelCase_						)
								__magic_name__	  = max(lowerCamelCase_						)

								# 3 cases, either (small1, big1),
								# (min_first, max_second), (small2, big2)
								# constant comparisons
								if biga - smalla > max_second - min_first and biga - smalla > biga - smalla:
												return smalla, biga
								elif biga - smalla > max_second - min_first:
												return smalla, biga
								else:
												return min_first, max_second


if __name__ == "__main__":
						import doctest

						doctest.testmod()







'''simple docstring'''
import random
import sys

__magic_name__   :   Optional[Any]  							='ABCDEFGHIJKLMNOPQRSTUVWXYZ'




def      __snake_case       (       ):
				'''simple docstring'''




				__magic_name__	  = input("Enter message: "						)
				__magic_name__	  = "LFWOAYUISVKMNXPBDCRJTQEGHZ"
				__magic_name__	  = input("Encrypt/Decrypt [e/d]: "						)

				check_valid_key(lowerCamelCase_						)

				if resp.lower().startswith("e"						):
								__magic_name__	  = "encrypt"
								__magic_name__	  = encrypt_message(lowerCamelCase_	,  lowerCamelCase_						)
				elif resp.lower().startswith("d"						):
								__magic_name__	  = "decrypt"
								__magic_name__	  = decrypt_message(lowerCamelCase_	,  lowerCamelCase_						)

				print(F'\n{mode.title()}ion: \n{translated}'						)




def      __snake_case       (       lowerCamelCase_ :				str						):
				'''simple docstring'''




				__magic_name__	  = list(lowerCamelCase_						)
				__magic_name__	  = list(lowerCamelCase_						)
				key_list.sort()
				letters_list.sort()

				if key_list != letters_list:
								sys.exit("Error in the key or symbol set."						)




def      __snake_case       (       lowerCamelCase_ :				str	,  lowerCamelCase_ :				str						):
				'''simple docstring'''




				return translate_message(lowerCamelCase_	,  lowerCamelCase_	,  "encrypt"						)




def      __snake_case       (       lowerCamelCase_ :				str	,  lowerCamelCase_ :				str						):
				'''simple docstring'''




				return translate_message(lowerCamelCase_	,  lowerCamelCase_	,  "decrypt"						)




def      __snake_case       (       lowerCamelCase_ :				str	,  lowerCamelCase_ :				str	,  lowerCamelCase_ :				str						):
				'''simple docstring'''




				__magic_name__	  = ""
				__magic_name__	  = LETTERS
				__magic_name__	  = key

				if mode == "decrypt":
								__magic_name__  ,      __magic_name__	  = chars_b, chars_a

				for symbol in message:
								if symbol.upper() in chars_a:
												__magic_name__	  = chars_a.find(symbol.upper()						)
												if symbol.isupper():
																translated += chars_b[sym_index].upper()
												else:
																translated += chars_b[sym_index].lower()
								else:
												translated += symbol

				return translated




def      __snake_case       (       ):
				'''simple docstring'''




				__magic_name__	  = list(lowerCamelCase_						)
				random.shuffle(lowerCamelCase_						)
				return "".join(lowerCamelCase_						)


if __name__ == "__main__":
						main()



