题解 | #查找兄弟单词#
查找兄弟单词
http://www.nowcoder.com/practice/03ba8aeeef73400ca7a37a5f3370fe68
shuru = input()
k = shuru.split(' ')[-1]
danci = shuru.split(' ')[-2]
beixuan = shuru.split(' ')[1:-2]
dic = {}
for i in danci:
dic[i] = danci.count(i)
xd1 = []
xd = []
for item in beixuan:
if len(item) == len(danci) and item != danci and set(item) == set(danci):
xd1.append(item)
for item1 in xd1:
x=1
for i in item1:
if item1.count(i) != dic[i]:
x=0
if x == 1:
xd.append(item1)
print(len(xd))
xd.sort()
if len(xd) >= int(k):
print(xd[int(k) - 1])