题解 | #找出字符串中第一个只出现一次的字符#
找出字符串中第一个只出现一次的字符
https://www.nowcoder.com/practice/e896d0f82f1246a3aa7b232ce38029d4
while True: try: str = list(input()) res = "" pos = 0 for s in str: if str.count(s) == 1 and pos == 0: res = s pos = 1 # 只打印第一个,类推打印第多少个都可以 print(res) if pos == 0: print(-1) except: break