wuyijiong是抄的(他有注释)
2024-11-16 17:19:07
发布于:浙江
4阅读
0回复
0点赞
N = int(input())
names = []
for _ in range(N):
name = input()
names.append(name)
name_count = {}
for name in names:
if name in name_count:
name_count[name] += 1
else:
name_count[name] = 1
max_count = 0
most_frequent_name = ""
for name, count in name_count.items():
if count > max_count:
max_count = count
most_frequent_name = name
print(most_frequent_name, max_count)
这里空空如也
有帮助,赞一个