1class Solution(object):
2 def firstUniqChar(self, s):
3 """
4 :type s: str
5 :rtype: int
6 """
7 frequency = {}
8 for i in s:
9 if i not in frequency:
10 frequency[i] = 1
11 else:
12 frequency[i] +=1
13 for i in range(len(s)):
14 if frequency[s[i]] == 1:
15 return i
16 return -1
17ob1 = Solution()
18print(ob1.firstUniqChar("people"))
19print(ob1.firstUniqChar("abaabba"))