题解 | #查找兄弟单词#

查找兄弟单词

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-13 10:15
门头沟学院 Java
想去夏威夷的大西瓜在...:我也是27届,但是我现在研一下了啥项目都没有呀咋办,哎,简历不知道咋写
点赞 评论 收藏
分享
后来123321:别着急,我学院本大二,投了1100份,两个面试,其中一个还是我去线下招聘会投的简历,有时候这东西也得看运气
无实习如何秋招上岸
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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