题解 | 找出字符串中第一个只出现一次的字符
import sys from collections import Counter raw_input = [] for i,line in enumerate(sys.stdin): raw_input.append(line.strip()) if i == 1: break input_str = raw_input[0] res = -1 counts = Counter([c for c in input_str]) for c in input_str: if counts[c] == 1: res = c break print(res)