import java.util.NoSuchElementException; import java.util.Scanner; import java.util.Stack; /** * A Class to use stacks to determine if a string is a palindrome * This downcases the text and removes spaces. * It also removes most punctuation */ public class Palindromer { public boolean palCheck(String pal) { pal = pal.toLowerCase().replace(" ", "").replace(".", "").replace(",","").replace(";","").replace("?","").replace("!",""); // really want char in stack, but it is primitive type // so use Character similar to int/Integer Stack aSStr = new Stack<>(); int middle = pal.length()/2; // first push onto stack the characters up to the middle of the string for (int i=0; i