import java.util.*; public class CheckPalindrome{ public static void main(String[]args){ Scanner input=new Scanner(System.in); System.out.print("Enter String: "); String st=input.next(); String str[]=st.split(""); String reversedSt=""; for(int i=str.length-1;i>=0;i--){ reversedSt+=str[i]; } if(st.equalsIgnoreCase(reversedSt)){ System.out.println("String is palindrome"); } else{ System.out.println("String is not palindrome"); } } }
can any one rewrite this code using stacks java stacks?