Last active
May 1, 2020 11:19
-
-
Save maggit/370beaf3694bbf1de2ff to your computer and use it in GitHub Desktop.
Detecta Palindromos
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
#Escribe un programa que detecte palindromos | |
#Un palindromo es una palabra, número o frase que se lee igual hacia adelante que hacia atrás | |
# Ejemplos | |
# 1) reconocer | |
# 2) adan no calla con nada | |
# 3) 14941 | |
#Bonus: entre mas pequeño el programa mejor! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
puts "Ingresa una palabra"
palabra = gets
palabra = palabra.gsub(/[\s,]/ ,"")
if palabra == palabra.reverse
puts "#{palabra} es un palindromo"
else
puts "#{palabra} no es un palindromo"
end