PokeMon/alexejbag208
PokeMon/Votintsev-Alexey
f1from collections import *f1from collections import *
2owners = defaultdict(list)2owners = defaultdict(list)
3cards = defaultdict(list)3cards = defaultdict(list)
4d = dict()4d = dict()
5res = []5res = []
6s = input()6s = input()
7while s:7while s:
8    temp = s.split(' / ')8    temp = s.split(' / ')
tt9    # if temp[1].isdigit():
10    #     owners[temp[0]].append(temp[1])
11    # else:
12    #     cards[temp[0]].append(temp[1])
9    if len(temp[0].split(' ')) == 2:13    if len(temp[0].split(' ')) == 2:
10        owners[temp[0]].append(temp[1])14        owners[temp[0]].append(temp[1])
11    elif '0' <= temp[1] <= '9':15    elif '0' <= temp[1] <= '9':
12        owners[temp[0]].append(temp[1])16        owners[temp[0]].append(temp[1])
13    else:17    else:
14        cards[temp[0]].append(temp[1])18        cards[temp[0]].append(temp[1])
15    s = input()19    s = input()
1620
17for k in owners:21for k in owners:
18    tmp = []22    tmp = []
19    for j in owners[k]:23    for j in owners[k]:
20        tmp += cards[j]24        tmp += cards[j]
21    owners[k] = len(set(tmp))25    owners[k] = len(set(tmp))
2226
23n = 027n = 0
24for k in owners.values():28for k in owners.values():
25    n = k if n < k else n29    n = k if n < k else n
26for k in owners:30for k in owners:
27    if owners[k] == n:31    if owners[k] == n:
28        res.append(k)32        res.append(k)
29res.sort()33res.sort()
30for j in res:34for j in res:
31    print(j)35    print(j)
3236
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op