题解 | #数据分类处理#
数据分类处理
http://www.nowcoder.com/practice/9a763ed59c7243bd8ab706b2da52b7fd
while True:
I = (input().split())[1:]
R = list(set(map(int, input().split()[1:])))
R.sort()
res = []
for r in R:
tmp = []
cnt = 0
for index,i in enumerate(I):
if str(r) in i:
cnt+=1
tmp.extend([str(index),i])
if cnt != 0:
tmp.insert(0, str(cnt))
tmp.insert(0, str(r))
res.extend(tmp)
print(str(len(res))+' '+' '.join(res))
except:
pass