题解 | #查找兄弟单词#

查找兄弟单词

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

inpt = input().split()

n = int(inpt[0])

danci = inpt[1:n+1]

x = inpt[-2]
k = int(inpt[-1])

brothers = []

for i in danci:
    if i != x and sorted(i) == sorted(x):
        brothers.append(i)

try:
    print(len(brothers))
    print(sorted(brothers)[k-1])  # 注意审题,题目说的是,需要按照字典排序
except:
    pass

全部评论

相关推荐

07-17 12:09
门头沟学院 Java
讲的口干舌燥,头都晕了怎么要讲这么长啊
码农索隆:没事,你口干舌燥,他不一定会看,
投递小鹏汽车等公司7个岗位
点赞 评论 收藏
分享
下北澤大天使:你是我见过最美的牛客女孩😍
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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