Created
October 27, 2010 05:09
-
-
Save rafapolo/648494 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
#!ruby | |
#encoding: utf-8 | |
#data: out-2010 | |
morses = { | |
'a' => '.-', | |
'b' => '-...', | |
'c' => '-.-.', | |
'd' =>'-..', | |
'e' => '.', | |
'f' => '..-.', | |
'g' => '--.', | |
'h' => '....', | |
'i' => '..', | |
'j' => '.---', | |
'k' => '-.-', | |
'l' => '.-..', | |
'm' => '--', | |
'n' => '-.', | |
'o' => '---', | |
'p' => '.--.', | |
'q' => '--.-', | |
'r' => '.-.', | |
's' => '...', | |
't' => '-', | |
'u' => '..-', | |
'v' => '...-', | |
'w' => '.--', | |
'x' => '-..-', | |
'y' => '-.--', | |
'z' => '--..' | |
} | |
morsed = "... --- ..." | |
puts morsed.split(" ").each{|letra| "Resultado: " << morses.key(letra)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Resultado: sos