算法1
C++ 代码
class Solution{
string s;
public:
//Insert one char from stringstream
void insert(char ch){
s+=ch;
}
//return the first appearence once char in current stringstream
char firstAppearingOnce(){
for(int i = 0; i < s.length(); i++)
{
char a = s[i];
if(s.find(a)==s.rfind(a))
{
return a;
}
}
return '#';
}
};