Advertisement
Guest User

Palindrome Checker 3

a guest
Nov 26th, 2015
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.33 KB | None | 0 0
  1. # This version removes spaces, commas, and quotes
  2. # to make the plaindrome checker work on whole sentences
  3.  
  4. input= gets.chomp
  5.  
  6. temp = input.downcase.gsub " ", ""
  7. temp = temp.gsub ",", ""
  8. temp = temp.gsub "'", ""
  9. puts temp
  10. if temp == temp.reverse
  11.   puts "#{input} is a palindrome"
  12. else
  13.   puts "#{input} is not a palindrome"
  14. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement