def check(input, solution, history):
    """ Compares input and the solution and outputs a mastermind-like result (black, white)"""
    white = black = 0
    for i in range(5):
        if(input[i] == solution[i]):
            black = black + 1
        if(input[i] in solution and input[i] != solution[i]):
            white = white + 1
    result = (black, white)
    history.append((input, result))
    return result