Find the string s in the first character appears only once. If not, return to a single space.
Example:
s = "abaccdeff"
返回 "b"
s = ""
返回 " "
You can utilize python dictionary.
class Solution:
def firstUniqChar(self, s: str) -> str:
numdic = dict()
for c in s:
if c in numdic:
numdic[c] += 1
else:
numdic[c] = 1
for i in numdic:
if numdic[i] == 1:
return i
return " "