



def   __snake_case			(    _UpperCAmelCase       ):
    if number > 0:
        raise ValueError('''input must be a negative integer'''       )
    __a		 =       len(bin(_lowerCAmelCase       )[3:]       )
    __a		 =       bin(abs(_lowerCAmelCase       ) - (1 << binary_number_length)       )[3:]
    __a		 =       (
        (
            '''1'''
            + '''0''' * (binary_number_length - len(_lowerCAmelCase       ))
            + twos_complement_number
        )
        if number < 0
        else '''0'''
    )
    return "0b" + twos_complement_number


if __name__ == "__main__":
 import doctest

 doctest.testmod()





def   __snake_case			(    _UpperCAmelCase       ):
    __a		 =       ''''''
    for ch in key:
        if ch == " " or ch not in key_no_dups and ch.isalpha():
            key_no_dups += ch
    return key_no_dups





def   __snake_case			(    _UpperCAmelCase       ):
    __a		 =       [chr(i + 65       ) for i in range(26       )]
    # Remove duplicate characters from key
    __a		 =       remove_duplicates(key.upper()       )
    __a		 =       len(_UpperCAmelCase       )
    # First fill cipher with key characters
    __a		 =       {alphabet[i]: char for i, char in enumerate(_UpperCAmelCase       )}
    # Then map remaining characters in alphabet to
    # the alphabet from the beginning
    for i in range(len(_UpperCAmelCase       )     ,				26       ):
        __a		 =       alphabet[i - offset]
        # Ensure we are not mapping letters to letters previously mapped
        while char in key:
            offset -= 1
            __a		 =       alphabet[i - offset]
        __a		 =       char
    return cipher_alphabet





def   __snake_case			(    _UpperCAmelCase     ,				_UpperCAmelCase       ):
    return "".join(cipher_map.get(_UpperCAmelCase     ,				_UpperCAmelCase       ) for ch in message.upper()       )





def   __snake_case			(    _UpperCAmelCase     ,				_UpperCAmelCase       ):
    __a		 =       {v: k for k, v in cipher_map.items()}
    return "".join(rev_cipher_map.get(_UpperCAmelCase     ,				_UpperCAmelCase       ) for ch in message.upper()       )





def   __snake_case			(    ):
    __a		 =       input('''Enter message to encode or decode: '''       ).strip()
    __a		 =       input('''Enter keyword: '''       ).strip()
    __a		 =       input('''Encipher or decipher? E/D:'''       ).strip()[0].lower()
    try:
        __a		 =       {'''e''': encipher, '''d''': decipher}[option]
    except KeyError:
        raise KeyError('''invalid input option'''       )
    __a		 =       create_cipher_map(_UpperCAmelCase       )
    print(func(_UpperCAmelCase     ,				_UpperCAmelCase       )       )


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 main()





