使用indexOf
//import java.util.*;
public class Solution {
//Insert one char from stringstream
int i = 0;
StringBuilder sb = new StringBuilder();
public void Insert(char ch){
sb.append(ch);
}
//return the first appearence once char in current stringstream
public char FirstAppearingOnce(){
while(i < sb.length() && sb.indexOf("" + sb.charAt(i)) != sb.lastIndexOf("" + sb.charAt(i))) i++;
return i < sb.length() ? sb.charAt(i) : '#';
}
}