题解 | #查找兄弟单词#

查找兄弟单词

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

全部评论

相关推荐

06-26 15:33
青岛工学院 Java
积极的秋田犬要冲国企:他现在邀请我明天面试
点赞 评论 收藏
分享
05-16 11:16
已编辑
东华理工大学 Java
牛客73769814...:盲猜几十人小公司,庙小妖风大,咋不叫她去4️⃣呢😁
牛客创作赏金赛
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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