University of Cincinnati logo and link
 
Palindromes
 
  UC ingot 
  • A palindrome is a word or phrase spelled the same way forwards as backwards, not counting spaces or punctuation.
    • Some palindromes are obvious: a, radar, bob.
  • We can state the following rule about a palindrome:
    • A word or phrase is a palindrome if the first and last letters are equal, and the letters between the first and last letters also form a palindrome.
    • We can use this rule to recursively test Strings for palindromability.
  • What our program must do:
    • Accept user input.
    • Remove all spaces and punctuation.
    • Recursively check for palindrome.
  • Test cases:
    • A Toyota.  Race fast, safe car.  A Toyota.
    • Now, sir, a war is never even -- sir, war is won!
    • Go hang a salami, I'm a lasagna hog.


  Permutations