import java.util.*;
public class Solution {
    private int[] counts = new int[128];
    private Queue<Character> queue = new LinkedList<>();
    //Insert one char from stringstream
    public void Insert(char ch)
    {
        counts[ch]++;
        queue.offer(ch);
        while(!queue.isEmpty() && counts[queue.peek()] > 1) {
            queue.poll();
        }
    }
  //return the first appearence once char in current stringstream
    public char FirstAppearingOnce()
    {
        if(queue.isEmpty()) {
            return '#';
        }
        return queue.peek();
    }
}