':type secret: str
:type guess: str
:rtype: str'

def getHint(self, secret, guess):

    (A, B) = (0, 0)
    (s_lookup, g_lookup) = (defaultdict(int), defaultdict(int))
    for (s, g) in izip(secret, guess):
        if (s == g):
            A += 1
        else:
            if s_lookup[g]:
                s_lookup[g] -= 1
                B += 1
            else:
                g_lookup[g] += 1
            if g_lookup[s]:
                g_lookup[s] -= 1
                B += 1
            else:
                s_lookup[s] += 1
    return ('%dA%dB' % (A, B))
