c++
字符流中第一个不重复的字符
http://www.nowcoder.com/questionTerminal/00de97733b8e4f97a3fb5c680ee10720
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; };