使用StringBuild+计数数组
字符流中第一个不重复的字符
http://www.nowcoder.com/questionTerminal/00de97733b8e4f97a3fb5c680ee10720
import java.util.*;
public class Solution {
//Insert one char from stringstream
StringBuilder str = new StringBuilder("");
int[] charCount = new int[128];
public void Insert(char ch)
{
charCount[ch]++;
str.append(ch);
}
//return the first appearence once char in current stringstream
public char FirstAppearingOnce()
{
char[] cha = str.toString().toCharArray();
for(char c:cha){
if(charCount[c]==1) return c;
}
return '#';
}
}