class Solution { string str; int hash[256]; public: //Insert one char from stringstream void Insert(char ch) { str.push_back(ch); hash[ch]++; } //return the first appearence once char in current stringstream char FirstAppearingOnce() { for(int i = 0; i < str.size(); ++i){ if(hash[str[i]] == 1) return str[i]; } return '#'; } };