From https://github.com/nighthawks-2014/code_samples/blob/master/palindrome.rb