Le code a été libéré, nous apprenons ensemble, entraidons
Titre:
Exemple d' entrée:
4 2
2333 6666
CYLL 3 1234 2345 3456
U 4 9966 6666 8888 6666
GG 2 2333 7777
JJ 3 0012 6666 2333
Exemple de sortie:
U: 6666 6666
GG: 2333
JJ: 6666 2333
3 5
Code ci-dessous (Python):
x, y = [int(i) for i in input().split()]
result = []
count = 0
obj = input().split()
for i in range(x):
flag = False
lst = input().split()
student = lst.pop(0) + ':'
for j in lst:
for k in obj:
if j == k:
student += ' '+j
count += 1
flag = True
if flag:
result.append(student)
for i in range(len(result)):
print(result[i])
print(str(len(result))+' '+str(count))