题解 | #名字的漂亮度#
名字的漂亮度
https://www.nowcoder.com/practice/02cb8d3597cf416d9f6ae1b9ddc4fde3
while 1: try: N = int(input()) s_list = [] beautiful_degree = [] for i in range(N): s_list.append(input()) for i in range(N): value = [] beautiful_value = 0 for c in set(s_list[i]): value.append(s_list[i].count(c)) n = len(value) for j in range(n): beautiful_value = beautiful_value + max(value) * (26 - j) value.pop(value.index(max(value))) beautiful_degree.append(beautiful_value) for i in range(len(beautiful_degree)): print(beautiful_degree[i]) except: break