50 第一次出现一次的字符

2018-06-26  本文已影响0人  土味老猪
class Solution(object):
    def firststr(self,String):
        dic = {}
        for i in String:
            dic[i] = dic.get(i,0)+1
        for j in dic:
            if dic[j] == 1:
                return j



s = Solution()
String = 'abaccdeff'
print(s.firststr(String))

上一篇下一篇

猜你喜欢

热点阅读