class Solution
{
public:
//Insert one char from stringstream
void Insert(char ch) {
++counts_[ch];
s_.push_back(ch);
}
//return the first appearence once char in current stringstream
char FirstAppearingOnce() {
for (const char& ch : s_)
if (counts_[ch] == 1)
return (char) ch;
return '#';
}
private:
int counts_[128];
string s_;
};