# -*- coding:utf-8 -*-
class Solution:
# 返回对应char,字符串与存储字符串中字符计数的字典
def __init__(self):
self.s = ''
self.dic = dict()
def FirstAppearingOnce(self):#
# write code here,输出第一个只出现1次的字符,无则输出#
for c in self.s:
if self.dic[c]==1:
return c
return '#'
def Insert(self, char):
# write code here,插入字符
self.s += char
self.dic[char] = self.dic.setdefault(char,0)+1



京公网安备 11010502036488号