题解 | #查找兄弟单词#
查找兄弟单词
https://www.nowcoder.com/practice/03ba8aeeef73400ca7a37a5f3370fe68
inpt = input().split()
n = int(inpt[0])
danci = inpt[1:n+1]
x = inpt[-2]
k = int(inpt[-1])
brothers = []
for i in danci:
if i != x and sorted(i) == sorted(x):
brothers.append(i)
try:
print(len(brothers))
print(sorted(brothers)[k-1]) # 注意审题,题目说的是,需要按照字典排序
except:
pass
查看11道真题和解析