题目链接:https://www.acwing.com/problem/content/description/60/
题目如下:
class Solution{
public:
unordered_map<char,int> umap;
vector<char> vtr;
//Insert one char from stringstream
void insert(char ch){
vtr.push_back(ch);
umap[ch]++;
}
//return the first appearence once char in current stringstream
char firstAppearingOnce(){
for(auto e:vtr){
if(umap[e]==1) return e;
}
return '#';
}
};