题解 | #查找兄弟单词#

查找兄弟单词

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

def solution(inp):
    n = int(inp[0])
    dic = inp[1 : n + 1]
    x = inp[-2]
    k = int(inp[-1])
    bro = []
    for item in dic:
        if item == x:
            continue
        if sorted(x) == sorted(item):
            bro.append(item)
    bro.sort()
    num = len(bro)
    print(num)
    try:
        brother = bro[k - 1]
        print(brother)
    except:
        pass


if __name__ == "__main__":
    inp_lst = input().split()
    solution(inp_lst)

全部评论

相关推荐

金俊涛:实习经历太简短了,丰富一些,实习还是很重要的,你好歹写点平常干什么,让hr有的问
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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