名字中,出现次数最多的字母,漂亮度为26
出现次数第二多的字母,漂亮度为25
。。。
总漂亮度等于次数乘以各字母漂亮度

while True:
    try:
        n = int(input())
        for i in range(n):
            name = input()
            n_sum = 0
            restr = ''
            L = []
            for x in name:
                if x not in restr:
                    L.append(name.count(x))
                    restr += x
            L.sort(reverse=True)
            for i in range(len(L)):
                n_sum += L[i] * (26 - i)
            print(n_sum)

    except:
        break