View Code of Problem 52

import java.util.*;
 
public class Main{
  
  public static void main(String[] args){
    Scanner in = new Scanner(System.in);
    String str = in.nextLine();
    Stack<Character> stack = new Stack<Character>();
    for(int i = 0;i<str.length();i++){
        stack.push(str.charAt(i));
    }
    
    while(!stack.empty()){
      System.out.print(stack.pop());
    }
    
  }
 
}

Double click to view unformatted code.


Back to problem 52