import sys
while True:
try:
I = input().strip().split()[1:]
s_r = input().strip().split()
#先转成数值排序
R = sorted(list(map(int, set(s_r[1:]))))
#再换回字符串
R = list(map(str,R))
# print(I)
# print(R)
Res = []
for c in R:
find = []
for index in range(len(I)):
if c in I[index]:
find.append(index)
find.append(I[index])
if len(find) > 0:
Res.append(c)
Res.append(len(find) // 2)
Res = Res + find
Res.insert(0, len(Res))
print(" ".join(map(str,Res)))
except:
# print(sys.exc_info())
break



京公网安备 11010502036488号