Last active
November 27, 2018 12:59
-
-
Save mikalai-yankouski/67f15c59f91f16de1f9a9c45c7a385d8 to your computer and use it in GitHub Desktop.
Дана строка. Необходимо проверить, является ли она палиндромом.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loop do | |
puts "Enter the word you want to check for palindrom words ('example' for example, 'exit' for quite)" | |
word = gets.chomp.downcase.strip | |
break if word == "exit" | |
if word == "example" | |
puts "Word '#{word}' is not a palindrome. Because '#{word}' not equal '#{word.reverse}'" | |
puts "Word 'deified' is a palindrome! Because word 'deified' equally read backwards\n" | |
elsif word == word.reverse | |
puts "You input: '#{word}'. It's a palindrome!" | |
else | |
puts "You input: '#{word}'. It's not a palindrome" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment