From 5d959e5aadf5f46f2b236a1edfeac04687eae9ce Mon Sep 17 00:00:00 2001 From: Andrew Ekstedt Date: Fri, 2 Dec 2022 21:27:37 -0800 Subject: [PATCH] day 3 --- day03/input | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++ day03/sol.py | 29 +++++ 2 files changed, 329 insertions(+) create mode 100644 day03/input create mode 100644 day03/sol.py diff --git a/day03/input b/day03/input new file mode 100644 index 0000000..52a8658 --- /dev/null +++ b/day03/input @@ -0,0 +1,300 @@ +WjmsdnddnmQPZPPJPL +bQllTtpBlgwtrbbCwfZcfSFPSfLCSF +GgVgQrlpphBGrlVGgTtsRHRWVRMzRdVsqdnDnV +MMTcbpnfNGQbMjgsRwSzRptRzz +lPqCCqQdQqQmCPRzRVSwtzgqqwqR +lrDdllPdBWdDFQFnMbDNDn +FldWTldlpBSLzvpnpSTpWbDhbHNDPHhJcNHNDwbH +qVCGQRGrrgMQrJhPNchgvgJhNc +frjGfMrGQMjsRrRQjvQGmrQQszTTpSLBznlzBlLLSBLLSZTn +TPZZZMTTbNTZNtTlTbjPVRVGzpGQLLzdGgmslhzSzgLzQh +wrfwDDvcnFvCfrrSQsmzGGQQdndsGg +qfHwHCqCqCrFJrcBHCCJRmWTRTmVMttjRjRHZMNV +vpbqnzbPmWLFjFLBnjZg +NltQcCClQlcGQGtMTCRdGTGBFZRLZjFFZZhBPLrFHZFjHf +lMtlGMwMsCCNlTwtsCPzzmPmmVpmpWqVWsWz +VmWVSchSrScGtwlVtBnwBVFF +RZZPRNpPCLZvZPZNCLbQPZNBFtttmwBMTMTtttCwtgwBgl +RNNmPvbQQjPRQQNNHpNbhsfzWJqqSJcsGHhHcfhq +dtJvcpccWvLDztRCRRCrCC +qHVslPzPqHqzmPhTzmDFggjrHrSCNFFFSjgR +qPVPMhszZPVhwBZcdpvZJncbcJ +HBNLlBDtvLDHhHLvfwlFjqfQTFqqWfST +ddsGcggJncZVRdGCdZdcWWzSFrjzQFrfTzqfCjFw +VdgscZmb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NDBZZdq +DMRhDhdvnjhnPnvPMfdZSGTccGJFjGFFpFpFTbTpTW +NVgVmtzVlLBmgztsBNmtgCmqFpJJFGGpGbrcGGsrcpbWPr +zwBztLBzllQPDZvfQZfRfHSR +mFCgPzmqgtPPqMmFWzbMttcRGvRclvHhWGGcZvclRfHh +psSNnhnLGnwZHZGv +hBpNLTNLBhsPmbCgBtPDbM +JsbLLWLJRfQFnccmQhtvvPCP +dwgrVwGpgVhCrrhPDHtC +gpGSjpVdVpVppjjVZBwdCbFRWLzLMSRMbNzfzbWR +DmMQMJmnmGwzGwwG +ZcLcgLgcRsZSctHFWLGfjjBwvbvBsvjpfhGb +GgFPqFtLRHLFSHLRRFRHHtMnJVNCQCrJCJCnMJDdnqDV +tqdqFqdsRdVdtHMNdRZHTZLrHJgrlZQPJLgr +GGwVcpGznmhbWhwcVVgzTrDrDDLZlTLLZQrJ +nhbnbfjcnfMfFNVtBq +QHmPNZvfCLsSwJSm +pDhjpVDFcRBpFFjjMnRcVhpFCzbzsZbSSCtwtLMSLZLLtLbs +FRjrnRchnfHPrrZlHl +bjjMbdChgRDZthpQpRQnwRTprRwS +mGzJsGsHzHGPvvvqvzGzSnglSJrrwQgnlQQSrlQl +qvzHqHLHmHgPsNBdCdZtVBtVVMBFbh +CctrCwrdpTwcpVrdpTpcrcnSJQttvQPHJQNQnQNjvvHQ +zsqRlslRLqfgRmWsRgRzqzQnHjSBSQWJHPhHnSvHnJJJ +GRgllbgfRgbzfRmwwcGdFMcTVPrFCF diff --git a/day03/sol.py b/day03/sol.py new file mode 100644 index 0000000..32a8f61 --- /dev/null +++ b/day03/sol.py @@ -0,0 +1,29 @@ +import string +letters = string.ascii_lowercase + string.ascii_uppercase + +rs = [] +t = 0 +for line in open("input"): + n = len(line.strip()) + n //= 2 + a, b = line[:n], line[n:] + rs.append(set(line[:2*n])) + u = set(a) & set(b) + assert len(u) == 1 + x = list(u)[0] + #print(x) + t += 1 + letters.index(x) + +print(t) + +t = 0 +for i in range(0, len(rs), 3): + a, b, c = rs[i:i+3] + #print(a & b & c) + u = a&b&c + assert len(u) == 1 + x = list(u)[0] + t += 1 + letters.index(x) + +print(t) +