题解 | 查找兄弟单词
查找兄弟单词
https://www.nowcoder.com/practice/03ba8aeeef73400ca7a37a5f3370fe68
import sys
lst_0 = input().split()
k=int(lst_0[-1])-1
x=lst_0[-2]
x_1=set(x)
lst_2 = lst_0[1:-2]
dc={}
lst_f=[]
for i in x_1:
dc[i]=x.count(i)
for word in lst_2:
ddc={}
if word!=x:
for i in set(word):
ddc[i]=word.count(i)
if dc==ddc:
lst_f.append(word)
print(len(lst_f),end="\n")
if k+1 <= len(lst_f):
print(sorted(lst_f)[k])
