class Solution{
public:
//Insert one char from stringstream
unordered_map<char,int>map;
queue<char> q;
void insert(char ch){
if(map[ch]==0) map[ch]=1,q.push(ch);
else map[ch]++;
}
//return the first appearence once char in current stringstream
char firstAppearingOnce(){
while(q.size()&&map[q.front()]>1)
q.pop();
if(q.empty()) return'#';
return q.front();
}
};