given a string find the first nonrepeating character in it and return it s index if it doesn t exist return 1 for example s leetcode return 0 s loveleetcode return 2 reference https leetcode comproblemsfirstuniquecharacterinastringdescription type s str rtype int type s str rtype int
def first_unique_char(s):
    
    if (len(s) == 1):
        return 0
    ban = []
    for i in range(len(s)):
        if all(s[i] != s[k] for k in range(i + 1, len(s))) == True and s[i] not in ban:
            return i
        else:
            ban.append(s[i])
    return -1