/* Written by Jen Chen Updated on March the 4th, 2003 Copyrighted by Jen Chen */ public class Palindrome_Driver { static String[] st = null; public static void main(String[] args) { String[] st = {"a364a", "abccba", "Cocococ", "@#$c$#@~", "12o21", "Mom", "coca8DcoC"}; //non palindrome.; if(args.length < 1){ System.out.println("USAGE: java Palindrome arg1 arg2 arg3 ...."); System.out.println("Use built-in data: "); }else{ for (int i = 0; i < args.length; i++) st[i] = args[i].trim(); }//end of IF() System.out.println("Checking palindrom using STACK:"); for(int i = 0; i < st.length; i++){ PalindromeStack pal = new PalindromeStack(st[i].trim()); if(pal.checkPalindrome(st[i])) System.out.println(st[i] + " is a palindrome!"); else System.out.println(st[i] + " is NOT a palindrome!"); }//end of FOR() System.out.println("\nChecking palindrom using QUEUE:"); //Check for palindrome using QUEUE for(int i = 0; i < st.length; i++){ PalindromeQueue pal = new PalindromeQueue(st[i].trim()); if(pal.checkPalindrome(st[i])) System.out.println(st[i] + " is a palindrome!"); else System.out.println(st[i] + " is NOT a palindrome!"); }//end of FOR() }//end of main() }//end of class Palindrome{}