题解 | #HJ27 查找兄弟单词#

查找兄弟单词

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

Python版本

content = input().strip().split()

n = int(content[0])
words = content[1: 1+n]
x = content[1+n]
k = int(content[2+n])

as_x_list = sorted([word for word in words if sorted(word) == sorted(x)])
while (x in as_x_list):
    as_x_list.remove(x)

m = len(as_x_list)
print(m)
if (m > 0):
    try:
        as_x_k = as_x_list[k-1]
        print(as_x_k)
    except Exception:
        pass
全部评论
妙啊,妙啊
点赞 回复 分享
发布于 2022-07-30 13:13

相关推荐

01-03 19:22
宁夏大学 运营
点赞 评论 收藏
分享
评论
5
6
分享

创作者周榜

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