from collections import defaultdict import sys if __name__ == "__main__": dic = defaultdict(lambda: [0, 0]) query = input() index = 0 while(True): item = input() if(item != ""): dic[item][1] = index index += 1 if(item == ""): break for item in dic.keys(): count = 0 for c in item: if(c in query): count += 1 dic[item][0] = count items = dic.items() items = sorted(items, key=lambda x: (x[1][0], -1 * x[1][1]), reverse=True) length = min(5, len(items)) for i in range(0, length): print(items[i][0]) 这个是我的代码 我也不知道哪里不对😪
点赞 1

相关推荐

最喜欢秋天的火龙果很...:第一份工作一定要往大的去,工资低点没事。后面换工作会更好找,即使你去小公司,你也不可能不会换工作的。所以找大的去
点赞 评论 收藏
分享
快刀斩offer:干测试,项目组就我一个测试,准备在职考研跑路了
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务