题解 | #查找兄弟单词#

查找兄弟单词

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

while True:
    try:
        lst = input().split()
        words, x, k = lst[:-2], lst[-2], int(lst[-1])
        bros = []
        for w in words:
            if len(w) == len(x) and w != x:
                if sorted(w) == sorted(x):
                    bros.append(w)
        print(len(bros))
        if k <= len(bros):
            print(sorted(bros)[k-1])
    except:
        break
全部评论

相关推荐

09-24 18:30
已编辑
长春工业大学 产品经理
小肥罗:HR就是好人的缩写哈哈哈哈
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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