直接使用一个数组,存储对应ASCII码为下标的字符出现的个数
然后再遍历判断当数组中的值为1的时候,就是第一个出现的字符

public class Solution {
    //Insert one char from stringstream
    char[] chars = new char[256];
    StringBuffer sb = new StringBuffer();
    public void Insert(char ch)
    {
        sb.append(ch);
        chars[ch]++;
    }
  //return the first appearence once char in current stringstream
    public char FirstAppearingOnce()
    {
        char[] str = sb.toString().toCharArray();
        for(char c:str){
            if(chars[c] == 1)
                return c;
        }
        return '#';
    }