题解 | #查找兄弟单词#

查找兄弟单词

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

in_list = input().split(" ")

n = int(in_list[0])
k = int(in_list[-1])
x = in_list[-2]

c_list = in_list[1:-2]
sort_x = sorted(x)
res  = []
for c in c_list:
    if c != x and  sorted(c) == sort_x:
        res.append(c)

print(len(res))
if k < len(res):
    print(sorted(res)[k-1])

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务