classSolution:defgetHint(self,secret:str,guess:str) ->str: a ={} b ={}for i in secret:if i in a: a[i]+=1else: a[i]=1for i in guess:if i in b: b[i]+=1else: b[i]=1 bulls =0for i inrange(len(secret)):# Counting bullsif secret[i]== guess[i]: bulls +=1 a[secret[i]]-=1 b[secret[i]]-=1 cows =0for i in a:# Counting cowsif i in b: cows +=min(a[i], b[i]) res =str(bulls)+"A"+str(cows)+"B"return res