Begin forwarded message:

> From: James Koppel <darmaniiii / yahoo.com>
> Date: April 24, 2007 4:07:50 PM CDT
> To: submission / rubyquiz.com, submission / rubyquiz.com
> Subject: Please Forward: Ruby Quiz Submission
>
> Here is my submission to Ruby Quiz #121. My aim was succinctness,  
> and I daresay I succeeded.
>
> $code = { '.-' => "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"}
>
> def printTranslations(morse, english="")
>   puts english if "" == morse
>   (1..[4, morse.length].min).each { |n|
>     printTranslations(morse[n..-1], english + $code[morse[0,n]]) if  
> $code.has_key?(morse[0,n])}
> end
>
> puts "Input morse code string"
> printTranslations(gets.chomp)
>
> Ahhh...imagining that irresistible "new car" smell?
> Check out new cars at Yahoo! Autos.