题解 | #查找兄弟单词#

查找兄弟单词

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

while True:
    try:
        inputList = input().split()
        broList = []
        broStr = inputList[-2]
        outIndex = int(inputList[-1])
        cutList = inputList[1:len(inputList)-2]
        for i in cutList:
            if len(i) == len(broStr):
                 if i != broStr:
                    if ''.join(sorted(i)) == ''.join(sorted(broStr)):
                        broList.append(i)
        broList.sort()
        print(len(broList))
        if outIndex <= len(broList):
            print(broList[outIndex-1])
    except:
        break

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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