def similar(real, predicted):
    """
    Compare if the captcha code predicted is close to the real one
    :param real string: Real captcha string
    :param predicted string: Predicted captcha string
    :return
      wrong_letter_count float: Percentage of wrong letter
      wrong_letter_dict dict: Dict of all wrong letters as key and a counter
        of failed as value
    """
    wrong_letter_count = 0

    wrong_letter_dict = {}
    for real_letter, preddicted_letter in zip(real, predicted):
        if real_letter != preddicted_letter:
            wrong_letter_dict[real_letter] = \
                wrong_letter_dict.get(real_letter, 0) + 1
            wrong_letter_count += 1

    wrong_letter_count /= len(real)
    wrong_letter_count = 1.0 - wrong_letter_count

    return wrong_letter_count, wrong_letter_dict