题解code题目 给定一个字符串,找到它的第一个不重复的字符,并返回它的索引。如果不存在,则返回 -1。 题解感觉没啥好写,遍历统计就是了 codeclass Solution: def firstUniqChar(self, s: str) -> int: countCh = collections.Counter(s) for i, ch in enumerate(s): if countCh[ch] == 1: return i return -1