<jupyter_start><jupyter_text>说明：1、给定一个字符串，找到其中的第一个非重复字符并返回其索引。如果不存在，则返回-1。Examples:    s = "leetcode"    return 0.例2：    s = "loveleetcode"    return 2.<jupyter_code>class Solution:
    def firstUniqChar(self, s: str) -> int:
        if len(s) == 1: return 0
        
        rets = []
        for i, char in enumerate(s):
            if char in s[i+1:] and char not in rets:
                rets.append(char)
        
        for i, char in enumerate(s):
            if char not in rets:
                return i
        return -1
s_ = "a"
solution = Solution()
solution.firstUniqChar(s_)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11308562197092084, 'fraction_numerical': 0.014539579967689823, 'mean_word_length': 2.1, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '288793', 'license': 'Apache-2.0', 'n_tokens_mistral': 251, 'n_tokens_neox': 243, 'n_words': 55, 'path': 'String/0821/387. First Unique Character in a String.ipynb', 'repo_name': 'YuHe0108/Leetcode', 'size': '619'}