def _get_outcome(guess: str, solution: str) -> str:
    """Get outcome string for the given guess / solution combination

    Args:
        guess: the word guessed
        solution: puzzle solution

    Returns:
        5-character string of:
            '0' = letter not present
            '1' = letter present but not in correct position
            '2' = letter present and in correct position
    """

    # We use lists to have mutable objects to work with
    outcome = list("-----")
    guess_list = list(guess)
    solution_list = list(solution)

    # Get 0 and 2 first - this manages multiple occurrences of the same letter
    # whereby a letter in the correct position should take precedence
    # over one not in the correct position
    for position in range(5):

        # Letter not present = 0
        if guess_list[position] not in solution_list:
            outcome[position] = "0"
            guess_list[position] = "-"

        # Letter in correct position = 2
        elif guess_list[position] == solution_list[position]:
            outcome[position] = "2"
            solution_list[position] = "-"
            guess_list[position] = "-"

    # Now mop up remaining letters
    for position in range(5):
        if guess_list[position] != "-":
            if guess_list[position] not in solution_list:
                outcome[position] = "0"

            else:
                outcome[position] = "1"
                solution_list[solution_list.index(guess_list[position])] = "-"

    return "".join(outcome)