import java.util.*;

public class Solution {
    
    public int[] chrs = new int[128];
    public LinkedList<Character> queue = new LinkedList<>();
    
    //Insert one char from stringstream
    public void Insert(char ch)
    {
        int num = chrs[Integer.valueOf(ch)];
        if (num == 0) {
            queue.add(ch);
        }
        else {
            queue.remove(Character.valueOf(ch));
        }
        num++;
        chrs[Integer.valueOf(ch)] = num;
        
    }
  //return the first appearence once char in current stringstream
    public char FirstAppearingOnce()
    {
        return queue.peekFirst() == null ? '#' : queue.peekFirst();
    }
}