Skip to content

Instantly share code, notes, and snippets.

@jackmott
Created April 29, 2017 20:03
Show Gist options
  • Select an option

  • Save jackmott/52066b655632a527410a51b5458f1668 to your computer and use it in GitHub Desktop.

Select an option

Save jackmott/52066b655632a527410a51b5458f1668 to your computer and use it in GitHub Desktop.
nim
proc nameScore(name : string) : int =
for c in name:
result += int(c)-64
var names = "names.txt".readFile().replace("\"").split(',')
names.sort(system.cmp)
var sum =0
for i,name in names:
sum += nameScore(name)*(i+1)
echo sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment