我已经编写了下面的代码,我需要从它提供的列表中获取最大字符数。
def ssin(a):
ASAS = map(lambda y: (chr(ord('A')+y),len(filter(lambda x: ord(x) - ord('A') == y, a))),range(0,26))
return ASAS
ssin('THE AGES OF THE KINGS')
回答:
[('A', 1), ('B', 0), ('C', 0), ('D', 0), ('E', 3), ('F', 1), ('G', 2),
('H', 2), ('I', 1), ('J', 0), ('K', 1), ('L', 0), ('M', 0), ('N', 1),
('O', 1), ('P', 0), ('Q', 0), ('R', 0), ('S', 2), ('T', 2), ('U', 0),
('V', 0), ('W', 0), ('X', 0), ('Y', 0), ('Z', 0)]
如何找到给定字符串中的最大字符数?