import random
import sys

lowercase_  							=			"ABCDEFGHIJKLMNOPQRSTUVWXYZ"







def 					__lowerCAmelCase				(		):







    '''simple docstring'''
    __snake_case       :				int 			=    input("""Enter message: """   )
    __snake_case       :				Union[str, Any] 			=    """LFWOAYUISVKMNXPBDCRJTQEGHZ"""
    __snake_case       :				Dict 			=    input("""Encrypt/Decrypt [e/d]: """   )

    check_valid_key(__SCREAMING_SNAKE_CASE   )

    if resp.lower().startswith("""e"""   ):
        __snake_case       :				Tuple 			=    """encrypt"""
        __snake_case       :				Any 			=    encrypt_message(__SCREAMING_SNAKE_CASE		,							__SCREAMING_SNAKE_CASE   )
    elif resp.lower().startswith("""d"""   ):
        __snake_case       :				Dict 			=    """decrypt"""
        __snake_case       :				Union[str, Any] 			=    decrypt_message(__SCREAMING_SNAKE_CASE		,							__SCREAMING_SNAKE_CASE   )

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







def 					__lowerCAmelCase				(		__SCREAMING_SNAKE_CASE       :					str   ):







    '''simple docstring'''
    __snake_case       :				Union[str, Any] 			=    list(__SCREAMING_SNAKE_CASE   )
    __snake_case       :				Tuple 			=    list(__SCREAMING_SNAKE_CASE   )
    key_list.sort()
    letters_list.sort()

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







def 					__lowerCAmelCase				(		__SCREAMING_SNAKE_CASE       :					str		,							__SCREAMING_SNAKE_CASE       :					str   ):







    '''simple docstring'''
    return translate_message(__SCREAMING_SNAKE_CASE		,							__SCREAMING_SNAKE_CASE		,							"""encrypt"""   )







def 					__lowerCAmelCase				(		__SCREAMING_SNAKE_CASE       :					str		,							__SCREAMING_SNAKE_CASE       :					str   ):







    '''simple docstring'''
    return translate_message(__SCREAMING_SNAKE_CASE		,							__SCREAMING_SNAKE_CASE		,							"""decrypt"""   )







def 					__lowerCAmelCase				(		__SCREAMING_SNAKE_CASE       :					str		,							__SCREAMING_SNAKE_CASE       :					str		,							__SCREAMING_SNAKE_CASE       :					str   ):







    '''simple docstring'''
    __snake_case       :				Optional[Any] 			=    """"""
    __snake_case       :				Tuple 			=    LETTERS
    __snake_case       :				Any 			=    key

    if mode == "decrypt":
        __snake_case			, __snake_case       :				Dict 			=    chars_b, chars_a

    for symbol in message:
        if symbol.upper() in chars_a:
            __snake_case       :				Optional[int] 			=    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 					__lowerCAmelCase				(		):







    '''simple docstring'''
    __snake_case       :				int 			=    list(__SCREAMING_SNAKE_CASE   )
    random.shuffle(__SCREAMING_SNAKE_CASE   )
    return "".join(__SCREAMING_SNAKE_CASE   )


if __name__ == "__main__":
     main()




import math
from timeit import timeit







def 					__lowerCAmelCase				(		__SCREAMING_SNAKE_CASE       :					int   ):







    '''simple docstring'''
    __snake_case       :				Optional[Any] 			=    0
    __snake_case       :				Union[str, Any] 			=    abs(__SCREAMING_SNAKE_CASE   )
    while True:
        __snake_case       :				List[str] 			=    n // 1_0
        digits += 1
        if n == 0:
            break
    return digits







def 					__lowerCAmelCase				(		__SCREAMING_SNAKE_CASE       :					int   ):







    '''simple docstring'''
    return 1 if n == 0 else math.floor(math.log(abs(__SCREAMING_SNAKE_CASE   )		,							1_0   ) + 1   )







def 					__lowerCAmelCase				(		__SCREAMING_SNAKE_CASE       :					int   ):







    '''simple docstring'''
    return len(str(abs(__SCREAMING_SNAKE_CASE   )   )   )







def 					__lowerCAmelCase				(		):







    '''simple docstring'''
    from collections.abc import Callable

    def benchmark_a_function(__SCREAMING_SNAKE_CASE       :					Callable		,							__SCREAMING_SNAKE_CASE       :					int   ) -> None:
        __snake_case       :				Tuple 			=    F'''{func.__name__}({value})'''
        __snake_case       :				Union[str, Any] 			=    timeit(F'''__main__.{call}'''		,							setup="""import __main__"""   )
        print(F'''{call}: {func(__SCREAMING_SNAKE_CASE   )} -- {timing} seconds'''   )

    for value in (2_6_2_1_4_4, 1_1_2_5_8_9_9_9_0_6_8_4_2_6_2_4, 1_2_6_7_6_5_0_6_0_0_2_2_8_2_2_9_4_0_1_4_9_6_7_0_3_2_0_5_3_7_6):
        for func in (num_digits, num_digits_fast, num_digits_faster):
            benchmark_a_function(__SCREAMING_SNAKE_CASE		,							__SCREAMING_SNAKE_CASE   )
        print()


if __name__ == "__main__":
     import doctest

     doctest.testmod()
     benchmark()



