题解 | #HJ27 查找兄弟单词#
查找兄弟单词
http://www.nowcoder.com/practice/03ba8aeeef73400ca7a37a5f3370fe68
Python版本
content = input().strip().split()
n = int(content[0])
words = content[1: 1+n]
x = content[1+n]
k = int(content[2+n])
as_x_list = sorted([word for word in words if sorted(word) == sorted(x)])
while (x in as_x_list):
as_x_list.remove(x)
m = len(as_x_list)
print(m)
if (m > 0):
try:
as_x_k = as_x_list[k-1]
print(as_x_k)
except Exception:
pass