きったんの頭

#! /usr/bin/env python3
"""
pe22.py
https://mind.kittttttan.info/py/pe22

pe22.txt
https://mind.kittttttan.info/c/pe22.txt
"""

# https://mind.kittttttan.info/py/pe0
from pe import word_worth

def pe22():
    """
    What is the total of all the name scores in the file of first names?
    """
    with open('pe22.txt', 'r') as f:
        names_string = f.read()
    names = names_string.replace('"', '').split(',')
    names.sort()
    print(sum(word_worth(names[i]) * (i + 1) for i in range(len(names))))

if __name__ == "__main__":
    pe22()