<qiyuangong>299_Bulls_and_Cows_1.py
def getHint( secret, guess):
    check = {}
    ls = len(secret)
    bull, cow = 0, 0
    different = []
    for i in range(ls):
        if guess[i] == secret[i]:
            bull += 1
        else:
            different.append(i)
            try:
                check[secret[i]] += 1
            except KeyError:
                check[secret[i]] = 1
    for i in different:
        try:
            if check[guess[i]] > 0:
                cow += 1
                check[guess[i]] -= 1
        except:
            pass
    return "%dA%dB" % (bull, cow)
def sample_funcname ( var_0 , var_1 ) :
    var_2 = { }
    var_4 = len ( var_0 )
    var_6 , var_7 = 0 , 0
    var_8 = [ ]
    for var_10 in range ( var_4 ) :
        if var_1 [ var_10 ] == var_0 [ var_10 ] :
            var_6 += 1
        else :
            var_8.append ( var_10 )
            try :
                var_2 [ var_0 [ var_10 ] ] += 1
            except KeyError :
                var_2 [ var_0 [ var_10 ] ] = 1
    for var_10 in var_8 :
        try :
            if var_2 [ var_1 [ var_10 ] ] > 0 :
                var_7 += 1
                var_2 [ var_1 [ var_10 ] ] -= 1
        except :
            pass
    return "%dA%dB" % ( var_6 , var_7 )
