public static void main(String[] args) { //System.out.println("YES"); Deque<String > st=new LinkedList<>(); Scanner in=new Scanner(System.in); String preS = in.nextLine(); StringBuilder sb=new StringBuilder(); for (char c : preS.toCharArray()) { ...