Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 13 lines (10 sloc) 0.284 kb
1 2 3 4 5 6 7 8 9 10 11 12 13
def wordValue(word) {
    word.bytes.inject(0) { sum, i -> sum + i - 64 }
}

names = []
new File('names.txt').eachLine { line ->
    line.split(/,/).each { names << it[1..-2] }
}

result = 0
names.sort().eachWithIndex { name, i -> result += (i + 1) * wordValue(name) }

println result
Something went wrong with that request. Please try again.