题解 | #查找兄弟单词#

查找兄弟单词

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

def bro_words(words,x):
    res = []
    for word in words:
        if len(word) == len(x) and word != x:
            if sorted(word) == sorted(x):
                res.append(word)
    return res
try:
    while True:
        lst = input().split()
        n = int(lst[0])
        words = lst[1:n+1]
        x = lst[-2]
        k = int(lst[-1])
        bros = sorted(bro_words(words, x))
        print(len(bros))
        if k<=len(bros):
            print(bros[k-1])
except:
    pass
全部评论

相关推荐

05-23 20:31
已编辑
武汉大学 Java
内向的柠檬精在研究求职打法:注意把武大标粗标大 本地你俩不是乱杀
点赞 评论 收藏
分享
白火同学:能。我当初应届沟通了1200,收简历50,面试10左右吧,加油投吧
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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