1. 题目
www.nowcoder.com/practice/03…

2. 考点
1. 列表解包
num, *lis, x, k = s.split(' ')
2. 字符串组成成分一致
# 对字符串排序 就可以查看是否相等
sorted(x) == sorted(i)
核心代码
def test(s: str):
num, *lis, x, k = s.split(' ')
k = int(k)
result = []
for i in lis:
x != i and sorted(x) == sorted(i) and result.append(i)
result = sorted(result)
print(len(result))
if len(result) >= k:
print(result[k - 1])
if __name__ == '__main__':
try:
test(input())
except EOFError:
pass
4. 精简代码
def test(s: str):
num, *lis, x, k = s.split(' ')
k = int(k)
result = sorted([i for i in lis if x != i and sorted(x) == sorted(i)])
print(len(result))
if len(result) >= k:
print(result[k - 1])
if __name__ == '__main__':
try:
test(input())
except EOFError:
pass