"爱情的代码"
写Python代码来解决这个leetcode挑战:给出一个字符串s,找到其中的第一个不重复字符,并返回其索引.如果它不存在,返回 -1.
```python
def firstUniqChar(s: str) -> int:
    count_dict = {}
    for char in s:
        count_dict[char] = count_dict.get(char, 0) + 1 # Increamenting the count of each character
    
    for i, char in enumerate(s):
        if count_dict[char] == 1:
            return i # If the count of the character is 1, then it is the first non-repeating character, so return its index
    return -1 # If there is no non-repeating character, return -1
print(firstUniqChar("loveleetcode"))
```