题解 | #名字的漂亮度#
名字的漂亮度
http://www.nowcoder.com/practice/02cb8d3597cf416d9f6ae1b9ddc4fde3
n = int(input())
l = []
for i in range(n):
l.append(input())
for a in l:
b = list(set(list(a)))
# for x in b:
# print(x,a.count(x))
c = {x:a.count(x) for x in b}
# print(c)
d = sorted(c.items(),key=lambda v:v[1])
# print(d)
score = [score for score in range(27-len(d),27)]
num =[num[1] for num in d]
sum_max =0
for i in range(len(score)):
sum_max += score[i]*num[i]
print(sum_max)
l = []
for i in range(n):
l.append(input())
for a in l:
b = list(set(list(a)))
# for x in b:
# print(x,a.count(x))
c = {x:a.count(x) for x in b}
# print(c)
d = sorted(c.items(),key=lambda v:v[1])
# print(d)
score = [score for score in range(27-len(d),27)]
num =[num[1] for num in d]
sum_max =0
for i in range(len(score)):
sum_max += score[i]*num[i]
print(sum_max)