def aa(string): if not string: return False hashes={} for s in string: hashes[s]=hashes[s]+1 if hashes.get(s) else 1 for s in string: if hashes[s]==1: return s print(aa("hdahdghshaudiwaig"))