complete file is :
==========================================================
$h={
 "A" => %w{A B C D E F},
 "B" => %w{G H I J K L},
 "C" => %w{M N O P Q R},
 "D" => %w{S T U V W X Y Z}
}
$reverseh= $h.inject({}) { |h,(k,a)| a.each {|l| h[l]=k } ; h }

def conv(letter) $reverseh[letter] || letter end


print "Word ? "
while (word=$stdin.gets).size>1
 puts word.chomp.upcase.split(//).map { |l| conv(l) }.join("")
 print "Word ? "
end

==========================================================

for Ruiby do a
>gem require Ruby

and run with ruby 1.9 or 2.0 (not tested with ruby 1.8)

-- 
Posted via http://www.ruby-forum.com/.