1
0
Fork 0

03: Solve in Python

This commit is contained in:
Mia Herkt 2022-12-03 12:21:26 +01:00
parent f907f0611c
commit 4f8b582364
Signed by: mia
GPG key ID: 72E154B8622EC191
2 changed files with 310 additions and 0 deletions

300
03/input Normal file
View file

@ -0,0 +1,300 @@
fzmmmfwDWFzlQQqjCQjDGnqq
tJHJvLJVVttNsvTtTvgHHSVwCsQRQQZCZZMqQMQBnqBMQs
LgThNJhNSgTJVgvgtghPhbpfWzfbwfPmpprb
lDLnSnLZRjmWrlhrFF
PffQJNqJbPZbpmjrrCVNFmCh
qzbcbqfMfZMTfQTqqzzTPPLMHgBBBtHRStvgHRDBnSRL
WPZfJlZZCMwwZPWCwWzVHQhsshVSsfNQHdvQNN
FLGDGGnGdVjQQQDQ
ccFFbggLnRcLFRtFBmnJzdZZzZBMpwJlZMppMp
RZsnCZssCnDccJCnfcQfHTdzMzhdLdMTqdRqpRLwqq
tNrGNrrvGhTThQqw
rrFStPgrFWWgvmPgQjtmNtmJcfJcsJsZblDZfbfHDFHnfl
RdTfgbbPbJWDDqRvsDsmVG
NSQZLQZHpFGLqnLszrJm
ZMSNMHhNZMMSQwhQJWPBJCbhbcgtgfcJ
qZfqPvLnnZGpGpCJlvsMsMlHJJHB
mTWFFFTTtVSJMzzjWgSH
RbVdtdFtcrmbRQDDVHDQTbDNwLPLfnqZnhZhQnNwfNqnnn
nhHfSGHGThhZjnhrrSnsSczdzlfzzdQQVzRNFNcFdl
JJvCDvmCbtvpvbMmDvLbCJpmqdVVVcMcNGzRcNFcRRzRclQd
vwDCwtLmwLBDJmCHHjHHWGZHBnsnnj
QWTMqZhThbTbLwtGBrQfQQNr
jdzSSccVPPcgcLrDBtDVwCfNNC
vcBgcmssccplTnnTqsMhWW
FlcwZhBhGZhFJnGtZZFwlGsWRLHdWqMzPjWRLTLJHHjdWq
vfmrmbpfpMfzjHjfdM
VCSmVpmrNDMZhSMcsFnh
nHqQVtVZGGwwwnSF
fMBBBWCsCfMMbWfbsGmGzF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njFZdvHtMvsLsTsDtHsHDDqvpH
RWzNRWjRfgjNMMLvcMcLNt
WGGRQzzRmRmVQSgwrwJjjCbJhnbShJ
cjngcvcwbMwWnbMWjbgvnsjPftsqfthqsBtsJJJJBt
HrGFmDDzpmLTHpDsPfsBNBPfzZNPqN
DDVmDplDrpGSVSTTHGlpLnPwCRnWcvWCdPbbMvcVdW
BVRlBfPBffWswVWQsfwBNNPMFMmmGFZGnWZGtztrzMZMnz
HqSJchHTHbTgHhGhvmRzFmnFtzRF
RJqHTpgDLJDSqLJJPNVjsfPwBVsVLlfN
NDrBlSmrFBlbbJllmtHHwhNNhZztqHVRzQ
CMTCGLcvvtfCdCcCvCnMTMcTzjHwVZVRLjRRjQjRHRwzwjVH
dfGdgGMGPggnvfvgbtDtlSJPDSFJPslJ

10
03/solution.py Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env python3
import sys
S = G = 0
for l in zip(*[iter(list(map(lambda c: c - ord('A') + 27 if c < ord('a') else c - ord('a') + 1, map(ord, x.strip()))) for x in sys.stdin)] * 3):
G += set.intersection(*map(set, l)).pop()
S += sum(set(x[:int(len(x) / 2)]).intersection(x[int(len(x) / 2):]).pop() for x in l)
print(f"Silver: {S}\nGold: {G}")