
"""simple docstring"""
import os
import sys
import time

from . import transposition_cipher as trans_cipher




def     __lowerCamelCase  (		):


	"""simple docstring"""






	_UpperCAmelCase =						'''Prehistoric Men.txt'''
	_UpperCAmelCase =						'''Output.txt'''
	_UpperCAmelCase =						int(input("Enter key: "      )      )
	_UpperCAmelCase =						input("Encrypt/Decrypt [e/d]: "      )

	if not os.path.exists(snake_case_      ):
		print(f"File {input_file} does not exist. Quitting..."      )
		sys.exit()
	if os.path.exists(snake_case_      ):
		print(f"Overwrite {output_file}? [y/n]"      )
		_UpperCAmelCase =						input("> "      )
		if not response.lower().startswith("y"      ):
			sys.exit()

	_UpperCAmelCase =						time.time()
	if mode.lower().startswith("e"      ):
		with open(snake_case_      ) as f:
			_UpperCAmelCase =						f.read()
		_UpperCAmelCase =						trans_cipher.encrypt_message(snake_case_				,     snake_case_      )
	elif mode.lower().startswith("d"      ):
		with open(snake_case_      ) as f:
			_UpperCAmelCase =						f.read()
		_UpperCAmelCase =						trans_cipher.decrypt_message(snake_case_				,     snake_case_      )

	with open(snake_case_				,     "w"      ) as output_obj:
		output_obj.write(snake_case_      )

	_UpperCAmelCase =						round(time.time() - start_time				,     2      )
	print(("Done (", total_time, "seconds )")      )


if __name__ == "__main__":
			main()






"""simple docstring"""
from .stack import Stack




def     __lowerCamelCase  (		UpperCamelCase__      ):


	"""simple docstring"""






	_UpperCAmelCase =						Stack()
	_UpperCAmelCase =						{"(": ")", "[": "]", "{": "}"}
	for bracket in parentheses:
		if bracket in bracket_pairs:
			stack.push(UpperCamelCase__      )
		elif bracket in (")", "]", "}"):
			if stack.is_empty() or bracket_pairs[stack.pop()] != bracket:
				return False
	return stack.is_empty()


if __name__ == "__main__":
			from doctest import testmod

			testmod()

			__magic_name__		       =				['''((()))''', '''((())''', '''(()))''']
			print('''Balanced parentheses demonstration:\n''')
			for example in examples:
						__magic_name__		       =				'''''' if balanced_parentheses(example) else '''not '''
						print(f'''{example} is {not_str}balanced''')




