标签:函数 esc count i++ string ret oid rom class
如果当前字符流没有存在出现一次的字符,返回#字符。
class Solution { public: //Insert one char from stringstream void Insert(char ch) { str += ch; count[ch]++; } //return the first appearence once char in current stringstream char FirstAppearingOnce() { for(int i = 0;i<str.size();i++){ if(count[str[i]] == 1) return str[i]; } return ‘#‘; } private: int count[256]={0}; string str; };
标签:函数 esc count i++ string ret oid rom class
原文地址:http://www.cnblogs.com/xiuxiu55/p/6683464.html