A simple python solution


#1
A=list(A)
A.sort()
ans={}
for i in range(len(A)):
     if A[i] in ans:
            return 1
     else:
            ans[B+A[i]]=i
return 0