def compare(guess, answer):
    """
    Compare guess and answer
    
    Arguments:
    guess -- a 4-digital number string of the guess.
    answer -- a 4-digital number string of right answer.
    
    Returns:
    cow -- a number of the user guessed correctly in the correct place.
    bull -- a number of the user guessed correctly in the wrong place.
    """
    cow = 0
    bull = 0
    for i in range(len(guess)):
        if guess[i] == answer[i]:
            cow += 1
        if guess[i] in answer:
            bull += 1 
    bull = bull - cow
    return cow, bull