题解 | #数据分类处理#使用字典嵌套
数据分类处理
http://www.nowcoder.com/practice/9a763ed59c7243bd8ab706b2da52b7fd
```while True:
try:
lst = input().split()
lst_str = lst[1:]
num = input().split()
num_str = num[1:]
num_str = sorted(list(map(int, set(num_str))))
res = {}
for x in num_str:
count = 0
tmp_lst = []
for i in range(len(lst_str)):
if str(x) in lst_str[i]:
count += 1
tmp_lst.append(i)
tmp_lst.append(lst_str[i])
else:
continue
if count !=0:
res[x] = {count: tmp_lst}
out = []
for x in res:
out.append(x)
for i in res[x]:
out.append(i)
for j in res[x][i]:
out.append(j)
print(len(out),' '.join([str(x) for x in out]))
except:
break