Write a java program to reverse word of a stack. Take the input word from the user , insert every character (from the word) into a stack. The output from the stack should be the same as the input. 1. Push into stack 2. Pop from stack 3. Enqueue into queue 4. Dequeue from queue 5. Push into stack 6. Pop from stack and display Solution import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; import java.util.Stack; public class ReverseStack { public static void main(String[] args) { Stack<String> stack = new Stack<String>(); Queue<String> queue = new LinkedList<String>(); Scanner sc = new Scanner(System.in); String word; while(true){ //reading word from user System.out.print(\"Enter word (exit to stop): \"); word = sc.next(); if(\"exit\".equalsIgnoreCase(word)) break; // pushing into stack stack.push(word); } //popping from stack and enqueue into queue while(!stack.isEmpty()){ queue.offer(stack.pop()); } //dequeuing from queue and pushing into staack while(!queue.isEmpty()){ stack.push(queue.poll()); } //popping from stack and displaying while(!stack.isEmpty()){ System.out.println(stack.pop()); } } } /* Sample output: Enter word (exit to stop): pravesh Enter word (exit to stop): cat Enter word (exit to stop): dog Enter word (exit to stop): apple Enter word (exit to stop): bat Enter word (exit to stop): boll Enter word (exit to stop): today Enter word (exit to stop): exit pravesh cat dog apple bat boll today */ .