题解 | #查找兄弟单词#

查找兄弟单词

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

def solution(x,k,strs):
    c = sorted(x)
    tmp = []
    for s in strs:
        if sorted(s) == c and s!=x:
            tmp.append(s)
    tmp = sorted(tmp)
    m = len(tmp)
    print(m)
    if k <= m:
        print(tmp[k-1])

while True:
    try:
        strs = input().split()
        x,k = strs[-2], int(strs[-1])
        solution(x,k,strs[1:-2])
    except:
        break

全部评论

相关推荐

10-13 13:49
南京大学 财务
饿魔:笑死我了,你简直是个天才
点赞 评论 收藏
分享
牛客吹哨人:哨哥晚点统一更新到黑名单:能救一个是一个!26届毁意向毁约裁员黑名单https://www.nowcoder.com/discuss/1525833
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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