//采用两个集合来解决这个问题,然后借助包含,添加,移除这三个函数
public class Solution {
public ArrayList<Character> store = new ArrayList<>();
public ArrayList<Character> temp = new ArrayList<>();
public void Insert(char ch) {
if(!store.contains(ch)&&!temp.contains(ch)){
store.add(ch);
}else {
store.remove((Character) ch);
temp.add(ch);
}
}
public char FirstAppearingOnce(){
if(store.size()==0){
return '#';
} else {
return store.get(0);
}
}
}