题解 | #数据分类处理#
数据分类处理
https://www.nowcoder.com/practice/9a763ed59c7243bd8ab706b2da52b7fd
I = input().split()[1:]
R = list(map(int,set(input().split()[1:])))
R.sort()
count = 0
res = ''
for i in map(str,R):
single_res = ''
i_count = 0
for j in range(len(I)):
if i in I[j]:
single_res += str(j)+' '+I[j]+' '
count += 2
i_count += 1
if i_count:
count += 2
single_res = i+' '+str(i_count)+' '+single_res
res += single_res
print(str(count)+' '+res)