Using names.txt, a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the list to obtain a name score.
For example, when the list is sorted into alphabetical order, COLIN, which is worth 3 + 15 + 12 + 9 + 14 = 53, is the 938th name in the list. So, COLIN would obtain a score of 938 × 53 = 49714.
What is the total of all the name scores in the file?
使用 names.txt,一个包含 5000 多个名字的 46K 文本文件,首先将其按字母顺序排序。 然后计算出每个名称的字母值,将此值乘以其在列表中的字母位置以获得名称分数。
例如,当列表按字母顺序排序时,COLIN 的值为 3 + 15 + 12 + 9 + 14 = 53,是列表中的第 938 个名称。 因此,COLIN 将获得 938 × 53 = 49714 的分数。
文件中所有姓名分数的总和是多少?
% write a solution here
fid