题解 | #查找兄弟单词#
查找兄弟单词
https://www.nowcoder.com/practice/03ba8aeeef73400ca7a37a5f3370fe68
while True: try: from collections import Counter list1 = input().split(' ') # print(list1) n = int(list1[0]) list2 = list1[1:n+1] x = list1[n+1] k = int(list1[n+2]) dict1,dict2,list3 = {},Counter(x),[] # print(list2,x,k) for i in list2: dict1 = Counter(i) # print(dict1) if dict2 == dict1 and i != x: list3.append(i) if len(list3) == 0 or len(list3) <= k: print(len(list3)) else: list3 = sorted(list3,reverse=False) print(len(list3)) print(list3[k-1]) except: break