

from typing import Literal

A_						:     int			  =				'ABCDEFGHIJKLMNOPQRSTUVWXYZ'


def  __a    (				SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE ) ->       str:






    '''simple docstring'''
    __UpperCAmelCase			   =     LETTERS if mode == '''decrypt''' else key
    __UpperCAmelCase			   =     key if mode == '''decrypt''' else LETTERS
    __UpperCAmelCase			   =     ''''''
    # loop through each symbol in the message
    for symbol in message:
        if symbol.upper() in chars_a:
            # encrypt/decrypt the symbol
            __UpperCAmelCase			   =     chars_a.find(symbol.upper() )
            if symbol.isupper():
                translated += chars_b[sym_index].upper()
            else:
                translated += chars_b[sym_index].lower()
        else:
            # symbol is not in LETTERS, just add it
            translated += symbol
    return translated


def  __a    (				SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE ) ->       str:






    '''simple docstring'''
    return translate_message(SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE    ,				'''encrypt''' )


def  __a    (				SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE ) ->       str:






    '''simple docstring'''
    return translate_message(SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE    ,				'''decrypt''' )


def  __a    (				) ->       None:






    '''simple docstring'''
    __UpperCAmelCase			   =     '''Hello World'''
    __UpperCAmelCase			   =     '''QWERTYUIOPASDFGHJKLZXCVBNM'''
    __UpperCAmelCase			   =     '''decrypt'''  # set to 'encrypt' or 'decrypt'

    if mode == "encrypt":
        __UpperCAmelCase			   =     encrypt_message(SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE )
    elif mode == "decrypt":
        __UpperCAmelCase			   =     decrypt_message(SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE )
    print(f'''Using the key {key}, the {mode}ed message is: {translated}''' )


if __name__ == "__main__":
       import doctest

       doctest.testmod()
       main()







from __future__ import annotations

from collections import deque
from queue import Queue
from timeit import timeit

A_						:     Optional[int]			  =				{
    'A': ['B', 'C'],
    'B': ['A', 'D', 'E'],
    'C': ['A', 'F'],
    'D': ['B'],
    'E': ['B', 'F'],
    'F': ['C', 'E'],
}


def  __a    (				SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE ) ->       list[str]:






    '''simple docstring'''
    __UpperCAmelCase			   =     {start}
    __UpperCAmelCase			   =     [start]
    __UpperCAmelCase			   =     Queue()
    queue.put(SCREAMING_SNAKE_CASE )
    while not queue.empty():
        __UpperCAmelCase			   =     queue.get()
        for w in graph[v]:
            if w not in explored:
                explored.add(SCREAMING_SNAKE_CASE )
                result.append(SCREAMING_SNAKE_CASE )
                queue.put(SCREAMING_SNAKE_CASE )
    return result


def  __a    (				SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE ) ->       list[str]:






    '''simple docstring'''
    __UpperCAmelCase			   =     {start}
    __UpperCAmelCase			   =     [start]
    __UpperCAmelCase			   =     deque([start] )
    while queue:
        __UpperCAmelCase			   =     queue.popleft()
        for child in graph[v]:
            if child not in visited:
                visited.add(SCREAMING_SNAKE_CASE )
                result.append(SCREAMING_SNAKE_CASE )
                queue.append(SCREAMING_SNAKE_CASE )
    return result


def  __a    (				SCREAMING_SNAKE_CASE ) ->       None:






    '''simple docstring'''
    __UpperCAmelCase			   =     f'''from __main__ import G, {name}'''
    __UpperCAmelCase			   =     1_0_0_0_0
    __UpperCAmelCase			   =     timeit(f'''{name}(G, \'A\')'''    ,				setup=SCREAMING_SNAKE_CASE    ,				number=SCREAMING_SNAKE_CASE )
    print(f'''{name:<35} finished {number} runs in {res:.5f} seconds''' )


if __name__ == "__main__":
       import doctest

       doctest.testmod()

       benchmark_function('breadth_first_search')
       benchmark_function('breadth_first_search_with_deque')
       # breadth_first_search                finished 10000 runs in 0.20999 seconds
       # breadth_first_search_with_deque     finished 10000 runs in 0.01421 seconds




