题解 | #查找兄弟单词#

查找兄弟单词

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

全部评论

相关推荐

Pandaileee:校友加油我现在也只有一个保底太难了
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务