class Solution
{
public:
//Insert one char from stringstream
map<char,int> m1;
char cur = ' ';
int index = 0;
vector<char> res;
void Insert(char ch) {
m1[ch]++;
res.push_back(ch);
}
//return the first appearence once char in current stringstream
char FirstAppearingOnce() {
int i = 0;
if(m1[res[index]] == 1){
return res[index];
}else{
for(i = index; i < res.size(); i++){
if(m1[res[i]] == 1){
index = i;
return res[index];
}
}
if(i == res.size()){
index = i - 1;
return '#';
}
else{return res[index];}
}
}
};