#思路:多条件排序常采用lambda函数实现 s = input() l = [] for i in set(s): l.append((i,s.count(i))) l.sort(key=lambda x:(-x[1],x[0])) # 谁在前谁优先,数值前加负号实现逆序 for i in range(len(l)): print(l[i][0], end="")
#思路:多条件排序常采用lambda函数实现 s = input() l = [] for i in set(s): l.append((i,s.count(i))) l.sort(key=lambda x:(-x[1],x[0])) # 谁在前谁优先,数值前加负号实现逆序 for i in range(len(l)): print(l[i][0], end="")