返回字符串中第一个只出现一次的字符,若无则返回空格。
class Solution
{
public:
char firstUniqueChar(string s)
{
unordered_map<char,int> m;
for(auto e: s)
{
m[e]++;
}
for(auto e: s)
{
if(m[e]==1) return e;
}
return ' ';
}
};