import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * A Class to use stacks to determine if a string is a palindrome * This downcases the text and removes spaces. However, it does not handle * punctuation in any way. */ public class Palindromer { public static void main(String[] args) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while (true) { System.out.println("Enter string to check for Palindrome"); String pal=""; try { pal = br.readLine(); } catch (IOException ioe) { System.err.println("Giving up in the face of an IO Exception " + ioe); System.exit(0); } pal = pal.toLowerCase().replace(" ", ""); boolean odd = pal.length()%2 == 1; // really want char in stack, but it is primitive type // so use Character similar to int/Integer ArrayStack aSStr = new ArrayStack<>(); for (int i=0; i