如题,所求最大漂亮度求解。
1)求出去重后各个字母出现的个数。
2)出现重复字母最多的为26,次多为25依次类推。

def beautifldegree(s):
  s1 = set(s)
  n = len(s1)
  res = []
  for each in s1:
      res.append(s.count(each))
  res.sort(reverse = True)
  sum_ = 0
  for i in range(n):
      sum_ += (26 - i) * res[i]
  return sum_


while True:
  try:
    n = int(input())
    ans = []
    while n:
      s = input()
      ans.append(beautifldegree(s))
      n -= 1
    for each in ans:
      print(each)
  except:
    break