题解 | #找出字符串中第一个只出现一次的字符#
找出字符串中第一个只出现一次的字符
https://www.nowcoder.com/practice/e896d0f82f1246a3aa7b232ce38029d4
import sys def findstr(x): process_result = [] delete_result = [] result = [] for i in x: if i not in process_result: process_result.append(i) else: process_result.remove(i) delete_result.append(i) for i in process_result: if i not in delete_result: result.append(i) if len(result) != 0: return result[0] else: return -1 while True: try: str1 = input() if len(str1) > 0: print(findstr(str1)) else: break except: break