@@ -0,0 +1,1978 @@
+import java.io.*;%0Aimport java.util.*;%0A%0Apublic class Solution %7B%0A%09// Write your code here.%0A%09public Stack stack = new Stack();%0A%0A%09public Queue queue = new LinkedList();%0A%0A%09/**%0A%09 * A void pushCharacter(char ch) method that pushes a character onto a stack.%0A%09 * @param c%0A%09 */%0A%09public void pushCharacter(char c) %7B%0A%09%09stack.push(c);%0A%09%7D%0A%0A%09/**%0A%09 * A void enqueueCharacter(char ch) method that enqueues a character in the queue instance variable.%0A%09 * @param c%0A%09 */%0A%09public void enqueueCharacter(char c) %7B%0A%09%09queue.add(c);%0A%09%7D%0A%0A%09/**%0A%09 * A char popCharacter() method that pops and returns the character at the top of the stack instance variable%0A%09 * @return%0A%09 */%0A%09public char popCharacter() %7B%0A%09%09return (char) stack.pop();%0A%09%7D%0A%0A%09/**%0A%09 * A char dequeueCharacter() method that dequeues and returns the first character in the queue instance variable%0A%09 * @return%0A%09 */%0A%09public char dequeueCharacter() %7B%0A%09%09return (char) queue.remove();%0A%09%7D%0A%09%0A%09    public static void main(String%5B%5D args) %7B%0A        Scanner scan = new Scanner(System.in);%0A        String input = scan.nextLine();%0A        scan.close();%0A%0A        // Convert input String to an array of characters:%0A        char%5B%5D s = input.toCharArray();%0A%0A        // Create a Solution object:%0A        Solution p = new Solution();%0A%0A        // Enqueue/Push all chars to their respective data structures:%0A        for (char c : s) %7B%0A            p.pushCharacter(c);%0A            p.enqueueCharacter(c);%0A        %7D%0A%0A        // Pop/Dequeue the chars at the head of both data structures and compare them:%0A        boolean isPalindrome = true;%0A        for (int i = 0; i %3C s.length/2; i++) %7B%0A            if (p.popCharacter() != p.dequeueCharacter()) %7B%0A                isPalindrome = false;                %0A                break;%0A            %7D%0A        %7D%0A%0A        //Finally, print whether string s is palindrome or not.%0A        System.out.println( %22The word, %22 + input + %22, is %22 %0A                           + ( (!isPalindrome) ? %22not a palindrome.%22 : %22a palindrome.%22 ) );%0A    %7D%0A%7D%0A

Create Day_18_Queues_and_Stacks.java