题解 | #计算字符串的距离#
找出字符串中第一个只出现一次的字符
http://www.nowcoder.com/practice/e896d0f82f1246a3aa7b232ce38029d4
while True: try: the_str = input() char_map = {} for i in range(len(the_str)): if the_str[i] not in char_map.keys(): char_map[the_str[i]] = True else: char_map[the_str[i]] = False exist = False for key, value in char_map.items(): if value == True: print(key) exist = True break if exist == False: print(-1) except: break