class Solution
{
public:
    //Insert one char from stringstream
    void Insert(char ch)
    {
        hashmap[ch] ++;
        data+=ch;
    }
    //return the first appearence once char in current stringstream
    char FirstAppearingOnce()
    {
        for (size_t i = 0; i < data.length(); ++ i) {
            if (hashmap[data[i]] == 1) return data[i];
        }
        return '#';
    }

    string data;
    unordered_map<char, int> hashmap;
};