2 $log = Logger
.new(STDERR)
3 $log.level
= Logger
::WARN
5 def value_of_char(char
)
9 def value_of_word(word
)
10 word
.scan(/./).map
{|c
| value_of_char c
}.reduce(:+)
15 $names = File
.read('euler22-names.txt').strip
.slice(1..-2).split('","').sort
16 $names.each_index
do |i
|
17 total
+= (i
+ 1) * value_of_word($names[i
])