题解 | #查找兄弟单词#

查找兄弟单词

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]))
全部评论

相关推荐

明天不下雨了_人机版:让我们大声的说出来:以前的未来就是现在
点赞 评论 收藏
分享
每晚夜里独自颤抖:这个在牛客不是老熟人了吗
点赞 评论 收藏
分享
评论
1
1
分享

创作者周榜

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