对于每个字符c有count()找出其出现的次数,次数为1直接返回其下标idx,若都出现了一次以上返回-1
idx=0 for c in s: if(s.count(c)==1):·//字符c只出现了一次 return idx idx+=1 return -1