It's probably coming from your input. Try replacing "gets.to_s" with 
"gets.chomp"

-- 
Posted via http://www.ruby-forum.com/.