





'''simple docstring'''






from string import ascii_uppercase
def 				_lowerCamelCase(	UpperCamelCase__     :			str     ,							UpperCamelCase__     :			str     ,							UpperCamelCase__     :			bool = False     ,							UpperCamelCase__     :			str = ascii_uppercase		)		->	str:
    A							:							Tuple				=    keyword.upper()
    A							:							Any				=    plaintext.upper()
    A							:							Union[str, Any]				=    set(UpperCamelCase__		)

    # create a list of unique characters in the keyword - their order matters
    # it determines how we will map plaintext characters to the ciphertext
    A							:							int				=    []
    for char in keyword:
        if char in alphabet_set and char not in unique_chars:
            unique_chars.append(UpperCamelCase__		)
    # the number of those unique characters will determine the number of rows
    A							:							int				=    len(UpperCamelCase__		)

    # create a shifted version of the alphabet
    A							:							Optional[int]				=    unique_chars + [
        char for char in alphabet if char not in unique_chars
    ]

    # create a modified alphabet by splitting the shifted alphabet into rows
    A							:							Optional[int]				=    [
        shifted_alphabet[k : k + num_unique_chars_in_keyword]
        for k in range(0     ,							26     ,							UpperCamelCase__		)
    ]

    # map the alphabet characters to the modified alphabet characters
    # going 'vertically' through the modified alphabet - consider columns first
    A							:							Optional[Any]				=    {}
    A							:							Any				=    0
    for column in range(UpperCamelCase__		):
        for row in modified_alphabet:
            # if current row (the last one) is too short, break out of loop
            if len(UpperCamelCase__		) <= column:
                break

            # map current letter to letter in modified alphabet
            A							:							List[Any]				=    row[column]
            letter_index += 1

    if verbose:
        print(UpperCamelCase__		)
    # create the encrypted text by mapping the plaintext to the modified alphabet
    return "".join(mapping[char] if char in mapping else char for char in plaintext		)


if __name__ == "__main__":
     # example use
     print(mixed_keyword("""college""", """UNIVERSITY"""))







'''simple docstring'''






import timeit


class 	_lowercase    :


   def __init__(			self     , _UpperCAmelCase       ):
       if isinstance(_UpperCAmelCase     , _UpperCAmelCase       ):  # Initializes a matrix identical to the one provided.
           A							:							List[Any]				=    arg
           A							:							Dict				=    len(_UpperCAmelCase       )
       else:  # Initializes a square matrix of the given size and set values to zero.
           A							:							str				=    arg
           A							:							Union[str, Any]				=    [[0 for _ in range(self.n       )] for _ in range(self.n       )]


   def __mul__(			self     , _UpperCAmelCase       ):
       A							:							List[str]				=    Matrix(self.n       )
       for i in range(self.n       ):
           for j in range(self.n       ):
               for k in range(self.n       ):
                   matrix.t[i][j] += self.t[i][k] * b.t[k][j]
       return matrix







def 				_lowerCamelCase(	UpperCamelCase__     :			Union[str, Any]     ,							UpperCamelCase__     :			int		)		->	Union[str, Any]:
    A							:							Tuple				=    Matrix([[1, 0], [0, 1]]		)
    while b > 0:
        if b & 1:
            matrix *= a
        a *= a
        b >>= 1
    return matrix
def 				_lowerCamelCase(	UpperCamelCase__     :			int     ,							UpperCamelCase__     :			Tuple     ,							UpperCamelCase__     :			Any		)		->	Any:
    # Trivial Cases
    if n == 1:
        return fa
    elif n == 2:
        return fa
    A							:							Optional[Any]				=    Matrix([[1, 1], [1, 0]]		)
    A							:							int				=    modular_exponentiation(UpperCamelCase__     ,							n - 2		)
    return fa * matrix.t[0][0] + fa * matrix.t[0][1]
def 				_lowerCamelCase(	UpperCamelCase__     :			str     ,							UpperCamelCase__     :			Optional[Any]     ,							UpperCamelCase__     :			Any		)		->	List[Any]:
    # Trivial Cases
    if n == 1:
        return fa
    elif n == 2:
        return fa

    A							:							str				=    fa
    A							:							List[Any]				=    fa
    n -= 2

    while n > 0:
        A,						A							:							List[str]				=    fn_a + fn_a, fn_a
        n -= 1

    return fn_a
def 				_lowerCamelCase(	)		->	Union[str, Any]:
    A							:							Any				=    '''
from random import randint
from __main__ import fibonacci_with_matrix_exponentiation
'''
    A							:							Optional[int]				=    '''fibonacci_with_matrix_exponentiation(randint(1,70000), 1, 1)'''
    A							:							List[Any]				=    timeit.timeit(setup=UpperCamelCase__     ,							stmt=UpperCamelCase__     ,							number=100		)
    print('''With matrix exponentiation the average execution time is '''     ,							exec_time / 100		)
    return exec_time
def 				_lowerCamelCase(	)		->	List[Any]:
    A							:							str				=    '''
from random import randint
from __main__ import simple_fibonacci
'''
    A							:							Any				=    '''simple_fibonacci(randint(1,70000), 1, 1)'''
    A							:							str				=    timeit.timeit(setup=UpperCamelCase__     ,							stmt=UpperCamelCase__     ,							number=100		)
    print(
        '''Without matrix exponentiation the average execution time is '''     ,							exec_time / 100		)
    return exec_time
def 				_lowerCamelCase(	)		->	Optional[Any]:
    matrix_exponentiation_time()
    simple_fibonacci_time()


if __name__ == "__main__":
     main()
