题解 | #查找兄弟单词#

查找兄弟单词

http://www.nowcoder.com/practice/03ba8aeeef73400ca7a37a5f3370fe68



item = input()
n = int(item.split(' ')[0])
k = int(item.split(' ')[-1])
word = item.split(' ')[-2]
items =  item.split(' ')[1:-2]
a = []
new =[]
for i in range(n):
    if items[i] != word and sorted(items[i]) == sorted(word):
        a.append(items[i])

new = sorted(a)
if k > len(new):
    print(str(len(a)))
else:
    print(str(len(a))+'\n'+str(new[k-1]))
全部评论

相关推荐

不愿透露姓名的神秘牛友
07-09 12:10
直接上图
牛客13578115...:改得一般,不值80
点赞 评论 收藏
分享
07-07 14:30
复旦大学 Java
遇到这种人我也不知道说啥了
无能的丈夫:但我觉得这个hr语气没什么问题啊(没有恶意
点赞 评论 收藏
分享
评论
1
1
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务