取次数最多的

def find_max(s):
    d = {}

    for i in s:
        if i == ' ':
            pass
        elif i in d.keys():
            d[i] = d[i] + 1
        else:
            d[i] = 1

    name, number = d.popitem()

    for k, v in d.items():
        if v > number:
            number = v
            name = k

    return name, number

你可能感兴趣的:(取次数最多的)