题解 | 看不懂题目的可以看这里~#数据分类处理#
数据分类处理
http://www.nowcoder.com/practice/9a763ed59c7243bd8ab706b2da52b7fd
看这个图应该会更清楚一些
while True:
try:
a=input().split()[1:]
b=map(str,sorted(map(int,set(input().split()[1:]))))
totalNum=0
res=""
for num in b:
singleRes,count="",0
for i,v in enumerate(a):
if num in v:
singleRes+=str(i)+" "+v+" "
totalNum+=2
count+=1
if count:
singleRes=num+" "+str(count)+" "+singleRes
totalNum+=2
res+=singleRes
print((str(totalNum)+" "+res).rstrip())
except:
break