Name | Language | Tokens Sum | Tokens Part 1 | Tokens Part 2 | Last change | |
---|---|---|---|---|---|---|
1 | LiquidFun | Python | 249 | 108 | 141 | 10 months ago |
from
collections
import
Counter
def
sort_by
(
cards_and_bid
)
:
types
=
[
c
[
1
]
for
c
in
Counter
(
cards_and_bid
[
0
]
.
replace
(
"
J
"
,
"
"
)
)
.
most_common
(
)
]
or
[
0
]
types
[
0
]
+=
cards_and_bid
[
0
]
.
count
(
"
J
"
)
return
types
,
[
'
J
2
3
4
5
6
7
8
9
T
Q
K
A
'
.
index
(
card
)
for
card
in
cards_and_bid
[
0
]
]
print
(
sum
(
i
*
int
(
bid
)
for
i
,
(
cards
,
bid
)
in
enumerate
(
sorted
(
[
line
.
split
(
)
for
line
in
open
(
0
)
]
,
key
=
sort_by
)
,
1
)
)
)