import collections


def calculate_hints(guess: str, secret: str) -> tuple[int, ...]:
    """Compare a guess against a secret word and calculate a hint on how close the
    guess word is to the secret word.

    The hint will be comprised of the following:
        - 2 - the guess <char> is in the secret word and in the correct spot.
        - 1 - the guess <char> is in the secret word but in the wrong spot.
        - 0 - the guess <char> is not in the secret word at all.

    Args:
        guess (str): The guess word
        secret (str): The secret word

    Returns:
        tuple[int, ...]: The hint on how close the guess word is to the secret word.

    Examples:
        >>> calculate_hints("chess", "swiss")
        (0, 0, 0, 2, 2)

        >>> calculate_hints("orate", "oater")
        (2, 1, 1, 1, 1)
    """
    count_of_not_exact_matches = collections.Counter(
        secret for secret, guess in zip(secret, guess) if secret != guess
    )

    hint_pattern: list[int] = []

    for secret_char, guess_char in zip(secret, guess):
        if secret_char == guess_char:
            hint_pattern.append(2)  # green
        elif guess_char in secret and count_of_not_exact_matches[guess_char] > 0:
            hint_pattern.append(1)  # yellow
            count_of_not_exact_matches[guess_char] -= 1
        else:
            hint_pattern.append(0)  # grey

    return tuple(hint_pattern)