#coding=utf-8
import string
class Solution(object):
def firstUniqChar(self, s):
"""
:type s: str
:rtype: int
"""
k_v = {}
t = [s.find(i) for i in string.ascii_letters if s.count(i) == 1]
print t
if t == []:
return -1
else:
return min(t) #最小的index
if __name__ == '__main__':
print Solution().firstUniqChar("leetcode")
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交