链接:https://leetcode-cn.com/problems/di-yi-ge-zhi-chu-xian-yi-ci-de-zi-fu-lcof/
代码
class Solution {
public:
char firstUniqChar(string s) {
unordered_map<char, int> count;
for (auto c: s) {
count[c]++;
}
for (auto c: s) {
if (count[c] == 1) {
return c;
}
}
return ' ';
}
};