fork download
  1. puts "Ruby veresion #{RUBY_VERSION}"
  2.  
  3. str = "Hello, how are you?"
  4.  
  5. hash = Hash[ (:a .. :z).zip(1 .. 26) ]
  6. to_numbers = Proc.new{|char| hash[char.to_sym] || char}
  7.  
  8. puts "encoding..."
  9.  
  10. puts str.downcase.split("").map(&to_numbers).join(" ")
  11.  
Success #stdin #stdout 0.01s 8016KB
stdin
Standard input is empty
stdout
Ruby veresion 1.9.3
encoding...
8 5 12 12 15 ,   8 15 23   1 18 5   25 15 21 ?