while true print "Enter the potential palindrome you want to test ('quit' to exit)\n: " string = gets.strip if (string <=> "quit") == 0 exit end res = string.downcase.gsub(/[\s]/, '') <=> string.reverse.downcase.gsub(/[\s]/, '') if res == 0 puts "\"#{string}\" is a palindrome\n\n" else puts "\"#{string}\" is NOT a palindrome\n\n" end end