2021: day08: part 1
This commit is contained in:
parent
64ee9796ba
commit
fe5ce3b1a6
200
aoc2021/input/day08.txt
Normal file
200
aoc2021/input/day08.txt
Normal file
|
@ -0,0 +1,200 @@
|
||||||
|
beacf afbd bcead cgefa ecdbga efb gbfdeac ecgfbd acbdfe fb | bf efb bgecdfa egcfa
|
||||||
|
cbdgef cdfageb cegbd fecba edgf dcfbe dbcafg df fcd dbegca | bgcdef dgbec bfeac fdeg
|
||||||
|
bgdcfa dgabf bfdec baefd abeg eda afcdge ea bfceadg dfegba | efbad fbdea dae fagbd
|
||||||
|
cfdabe fcgbe gcdeb ecdfgb bdc cdgf cd cfageb bgdae daebfcg | decbaf cdfg deabg cd
|
||||||
|
eacgdfb fdbeca agedc cbedf dcfgab bgef gdf fdgec fbcged gf | gf acegd fdeabgc gfd
|
||||||
|
egcd aebdcf gbeca eg edfcbga gbe cfbag bdeca gadbec bdgefa | caegfbd dgcebfa eg bgdfae
|
||||||
|
fcgab egafb gedbca gfc cf ceagdf cafbdeg gcafbd dbagc cfdb | dbecga dbgcefa cfg fcg
|
||||||
|
geacd bg cbfead efgabcd fbace ceabg efbadg gfbc gab geabcf | cfbg fabce bg fdgeacb
|
||||||
|
bfceg ca baefc caedfb acfedgb cfad edacbg eac debaf bdfage | geadbc bfgeacd efagcdb cefbg
|
||||||
|
fd dcfbge fcad dfg bgaefc fdcgab fgdceab afdbg cbagf gdaeb | aecdgfb dbcfag cdaf gfecba
|
||||||
|
dabce gceab fegcab fbdca adeg gcabdfe gedbac ed egdfbc deb | fdegcb acbdf ed gdae
|
||||||
|
bgcea cbfdage egad ecadb beg befdcg fcgba aecbdf ge abedcg | geb gbe deag eg
|
||||||
|
bfecag egbdfac abecg gcebf efdagc ca acbf cfbegd eac bgaed | bdcegfa gbfce dbgecaf ac
|
||||||
|
fcbed dbfegca cdafbe edfgc abfde ebc egcfab dbca fdgbea cb | cb fgedc cb cdfeb
|
||||||
|
fb fdeacb bfe bfdc ebcgda afdeb acbfge agedf ecbad fdagcbe | gfcdbae fb abcefgd bef
|
||||||
|
egbca cfe eadbfg baedgfc cf bcfd afbde acebf fecdag edafbc | cfe caedfgb fc eadfgc
|
||||||
|
gfabc fbcaeg bagd cgbfaed dfecb gfdcb fcedga dg dafbgc dgf | abgd bdgcf ebcdfga fcedbga
|
||||||
|
cdb abce ebgfdc bfagdec abdcef dbfea gfdca facbd dfaebg cb | cdb cb dbc cdafbeg
|
||||||
|
afdbe dcfegb gedca adcbe ecfgbad fcadge cb acgdeb cbe agcb | dcage bec cb cb
|
||||||
|
gafdec cbdg fdgbce dce dfegb fceab becagdf dc dfbce agdefb | dgebf dc bfgde cde
|
||||||
|
bagfc bdef cgeafd eagfbcd afceb fe cfabde agcdeb cef eabdc | fbdgaec ef ef cafbe
|
||||||
|
fbage cgfba bdcage edagbf fe agcfdeb gfe adfe dgabe egbfdc | fe gfe geabf dgecab
|
||||||
|
gdfec bgfc dbgafe gfdebc dbfeg fc fabdcge fcd gedac dcbfea | egadc cfd efbdg gcbf
|
||||||
|
dacgf dfabc ebgcad daegfcb aedfbc dbgf agd aegfc cbfdag gd | agd gbdf bdafcge bcfegad
|
||||||
|
gdbea ebacdf adebfgc dfb df fbdea gcfebd fceab bfcgea fdac | gfabecd efdgbc fcebgd fbd
|
||||||
|
fba gbdcf cbae ebfgca fbcegda ab gbedfa gbacf gface gecdfa | ba bacgfde edfgac ab
|
||||||
|
fgebda bfgae cfdgba agcbe dbaegcf gbfda ef bfe gcbdfe dfea | ebgfdc eagcb eafd bef
|
||||||
|
agfecb cabef dafgec adfeb fbc gacb cb afbegdc cfaeg cbdefg | aegbfc fcb cgfdbe fcaged
|
||||||
|
agf eadfc cegabfd eagdf efdgb cgfbde agbfed gfbcae ag abdg | abdegf gbad baecgf afdbeg
|
||||||
|
gfbdac bd gcaefd bdcegfa gadbce dgb badf gbfdc fgecb cgadf | bgd fcbgd gdb dbfa
|
||||||
|
cbgf efcgbd aefdcbg feabd dcf cdebf ebcgda cf egcbd fadceg | dcf cf gcedaf bgfc
|
||||||
|
bacgfe fbc cgfe bcdagf gebfa cafeb bdcafge afdegb caedb cf | befga cbf gcfe bcf
|
||||||
|
bgdf geacf acedgb gb aecbfd bdcfa abgcf bgc acgefdb cdgabf | cdbgea gcb fdbg adgefcb
|
||||||
|
bdacgef fadeb abcg gfcebd gbf afbge egacf dgceaf bg aefgcb | gfb fbg dbgecfa bacg
|
||||||
|
dcegf bg cdafegb cfdebg fagced bge ecfab dbgace cgbef bdgf | gb gbfd adgefc ebg
|
||||||
|
gbf fbcdega egdafc bg aefgd gbecfd agbe abcdf edgafb fbdag | cgaefbd dfaeg dafgb dfeagc
|
||||||
|
beaf aed aecdf aebcgd eafdcb cgfabd ea gfcde cbdfa ceagdfb | fabe bafecd fecgdab ae
|
||||||
|
bdcfe gbdae bcgafd daegfb aecg cdagbe gfbadec gbc gc edcgb | cdbge efbgcda dagcbe agebdf
|
||||||
|
ec fdcag aegcbf bagfcd cgfade adecg fdaebcg fecd degba egc | deagc ec ebagd cafgeb
|
||||||
|
dcgaeb egadc agcfde efac beagdfc fcdagb dgcef gbfde dfc cf | cdf cf febadgc ecgfd
|
||||||
|
afd df gdafecb bdcf fecba acged edcabf egdbfa egfabc acdfe | cgebaf dacge fdbc decga
|
||||||
|
ga beafc cgbea dceagf feabdc bfagec abgf cga fdeagbc cebdg | cagbe bgfa gbced gabf
|
||||||
|
edag cdafb ae efacd eacgbf cedgbf afe fbceadg cdgaef egcdf | eaf cdafb efa ae
|
||||||
|
eagdbfc cagdf badcge fgec cg cdg bdfca feadg fecdga dfbega | abcfd dgc cgd gdc
|
||||||
|
beadg ca cdeba gcda acfebg dfbce fcbadge dbafge gdabec cae | gcad eca agbced gdbace
|
||||||
|
agfcde gdceab dbeaf agfed dg acfegb gaedbfc adg aegcf fgcd | bdefa cgebfad gdfc gd
|
||||||
|
gafcdb bfgaec daecf bcfgdea bged be dcgfb cfebd fbe dfebgc | fcabge dbfagec gebdfca gbfcd
|
||||||
|
dcaef agfbec gea ge bged cbdfag fgbade gbdefca abfgd faged | bfdcega aeg bdgaf bedg
|
||||||
|
dcbfa ag fcaegb fcdaegb gebdf adeg bdfga dgfeba ebcdgf gaf | cbgedfa ag egda ga
|
||||||
|
bcgdaef fcabde dbfage cfdgb daegf bfe dgefb gfadce egab eb | bfe gfeabd gdbef dagfbec
|
||||||
|
be egb fgcbde agdbcf gcdfb edbf bagecf ecadg bdefgca bdegc | efcdgab edgbcf efabcg dgecb
|
||||||
|
bcegfd ceafd gbefca eba dacebfg gebfd baegdf dabg dbfae ab | bae abcgef gbdcefa dbga
|
||||||
|
dceagfb edac ecfba cbgadf dfbge bcdefa fdc cd fcaegb edcbf | bdface cgfabde cdf cdafeb
|
||||||
|
cgaedbf acd afbdge afdcg bdcaeg gadfb ac gcbdfa abcf cdgef | gdfac cgdef cgfad cfbedga
|
||||||
|
gaefdcb debga cd aebcd gceafb afdceb cfabe dfcb dca agdcef | dbcafeg dfecag dbfc efgdacb
|
||||||
|
abdeg eaf cedfba aefdg gcadfe af gdfaecb gcfa gdfec cbgdef | fea cebfda dfceag fadcebg
|
||||||
|
bcgdfe fbdce fcdbea bcead adc ca bdgcaf edcgbaf baged feac | ecbad bfdec acd ac
|
||||||
|
bd aecfgb bfad gdb dgbace fbaegdc egbaf ecdgf egbdf fgadeb | fcageb dgb dgfeb bfad
|
||||||
|
bfcea dfbcea badge bfegdca gac cafdgb gc aecbgf caebg gefc | fegc bcaeg beafc feadbc
|
||||||
|
cagef fadgebc fd daf dcfbga ebdgfa cbeadg afdeg abegd ebdf | gbafedc daefg fd gbadec
|
||||||
|
dfaebc bcgaf bcaeg abecgf eagf dgecb cae ae dcgbafe gbadcf | ea gdecb bfacge gbace
|
||||||
|
dfbec gcbade fadb df badefcg dbeac cfgeb ebafcd fecdga edf | febcg cfadeg ebcgda dbfa
|
||||||
|
cadgfe bdfea dgbfeca dab dgbaec afdegb fdgb gaefd db cbfae | dgbf edabf bd dfgb
|
||||||
|
decbga ebfcgd gcebf cabfe aec cbfad ea eafg adbgcef cebfag | efga ea cgafbed acfdb
|
||||||
|
dcgefb gafc bagfce ca fcaeb aec dfbae ebgcf bcfdega deacgb | begcdfa ace fdegbac ac
|
||||||
|
gafc dgafecb cdgeba dbgafc fa bacdg fceabd fbgde afb fadgb | cafgdbe fbedagc adefbc gacefdb
|
||||||
|
dgfe dfa fd agcfbd bedac gfaec bdfcgae ebgcaf edfac acegfd | adf degf fad fedacgb
|
||||||
|
efgacdb gedfc eadbfg efd dcagf cfdage gdbacf gcbed fe fcae | eafdgb fdcge cafe dfe
|
||||||
|
aebg gbfdac dcebfga bdcef ebcfag abcfg acfeb dfcaeg ea eca | bega ace bacfg bgadcf
|
||||||
|
ceag caefgb agb fbgdc ag cafbg becfa cfeabd deafgb eafcgbd | cgadbef gba ag bag
|
||||||
|
bdge agbec dgcfae agbedcf gdc gbecad dabgc gd fbadc abefcg | gfcbaed dbge dg acfbd
|
||||||
|
dcef efb dbcfgae gbecfa fe ebcdag cafedb cadbe afdbe badfg | edcf ef fe fe
|
||||||
|
cdagfeb fgabc cafd fcb bdagc dfcgeb gbfacd cf baefg bdegac | cf acgbd fdac cdbfega
|
||||||
|
cefbdg debgca abfeg cebgf fdbgac adcgefb fcde cbe ce cdbgf | bgfae bec cfdebga cfegbd
|
||||||
|
fcbag gcfbed adgbefc afbdeg adbgf dbea ad cefagd daf debfg | da afd baegdfc afd
|
||||||
|
ba gbcda degcb bad adbegc fgcad eacb adgefb gdfaecb gcbedf | dgbaec gdbcfe dba ba
|
||||||
|
cdabf cbdgae facgb fadg acg gfbce ag cgdafb edcfab dbcegfa | dafg bdafec cbfeg facbg
|
||||||
|
edbaf cfebad aec cdaf ca gfabce cbeda afgebd fbdacge bcgde | ac afgbce dacf fcda
|
||||||
|
egdba bafeg bd gdfeba bcedfa agcde bad fgdb fceabg gabdefc | fbgae efgacb cadfeb bgdf
|
||||||
|
fdcgae dcefb cdb fecgabd afecb dbcfeg bgceda bd gfdb cdegf | dgabec cbdgae bcd aedcbgf
|
||||||
|
beg eg bfcea cdfgeb baefg abgdf fgeabd gcfdba agde dgbaefc | cdabgf dbefgc bdgfa facgebd
|
||||||
|
dbgef bfecgad egfcd agfbce agbde bf gcebdf dagfce cbdf feb | fbe ebfcdg bcfd fgcdabe
|
||||||
|
abgdec fgd fcgeb gedabf gfbdc dgaecbf afdc dgcafb fd bgcad | fgd adcf bgfcd fdegba
|
||||||
|
cafdb acdbge acedb dfbcg af ceadfbg adf adfgec faeb dcfeab | gdabfec bdgfc dcfba feab
|
||||||
|
dbcgae bcdfeg bfceadg bafgcd dacgb dfac cfgba bfc aefgb cf | dcegbf fc becagd fc
|
||||||
|
geacb gebfda gbcdafe efgc ge ecabd bcefag gfbcda age gafbc | adbfecg acbge cabedfg gea
|
||||||
|
gabce feagdb dgb fceadb deagb edbfa gd cbfgde agdbfec afdg | gbd begdcf aegbd bgd
|
||||||
|
afecbg fgeda dfeabgc cdafe adgb dg dbcegf fabged faebg egd | ged abfgced gd afcde
|
||||||
|
ec badfec cfe befgd gdacfe bace fgedbac gbcadf fdcba cfedb | ecf ec ce efcdb
|
||||||
|
dacfgb fd gfdbae ecbdgfa ecbdag cbfeg faed gdf aegbd egdfb | eacdbg gbfdea begfd becfdag
|
||||||
|
faegbd fgdace acbfeg dfgecba ed dabge fdbe dae badcg eagbf | dfeb dfgabe adcgb de
|
||||||
|
dbe gbcef acdebf defa geabdc de dfcbag dbgaecf cabfd becdf | eadf adcegb efcbg cfabdg
|
||||||
|
gcaed adgbce abfeg cb egcba cdba cgadef cgbefda fdbegc ebc | gbeaf cb bcad fadcge
|
||||||
|
cef fbacd gafedc ec gaecbdf bfedg gdcfeb bfdce cegb bfadeg | ec fbceagd fce fec
|
||||||
|
gfdae adgb cabfde fgdceb dea gafec bdgafec agdebf ad degfb | bcedgf bedacgf cegfa bcfgead
|
||||||
|
ec cge dagef eacgbf cdafegb cfgadb gbedca ecagd cdeb agcbd | cfagbd dcega gaecdb bgfaecd
|
||||||
|
ebgac cegbad dfcegb abegdf gbdec bae dcae efabgdc ea cgfba | ea eba deca bea
|
||||||
|
dcgfba adgbef feac afedgc dcegf egabfdc fc fdaeg bdceg dcf | beagcfd gdbcafe efac cf
|
||||||
|
cadfg gb cedagf gbd abgcfd fdcebga acgb febgda fdbec bdgcf | cagb cfagd gbd fegcbad
|
||||||
|
fgdca afcdeg bcdeagf gc fcaed defabc aedcbg bgfad cdg cfge | gc gdeacf agdbce fbacdge
|
||||||
|
fea adgeb bgfe fe dcfeag bafegd badcf aedbfgc adefb bcdeag | eafbd abfged begf egfb
|
||||||
|
gace dagcf fedac fbceagd defab cfe gdcfeb cdfgae ec gbfadc | ecf cagefbd befgdac acge
|
||||||
|
afc gaedf dfecga bafcdge cf bgdac dafcg eacbfd gbdafe gcef | adbcg fca agdbfce acf
|
||||||
|
cdfebg dcbe fgbdac bfegd be beagfc gfdea gacfbed fbe cgfbd | gedabfc eb eb aegcbfd
|
||||||
|
afg dfgec gcfeab ebcfagd fa adfe bagcd gdcfa gfbedc gecdfa | fa eacgdbf fa defa
|
||||||
|
bfdag gbecd cefg efcbdga fbc cf gbcfd badfec bedfcg egcbda | gadefcb bfc bacfde bgedc
|
||||||
|
cafde dce dcbfa dgcefb cgea dgafceb fgcdae dagfe gfebad ec | fcdae dbgfec gfdea dfcgeba
|
||||||
|
gcebad cfgdb cfgeab cdb cd egcdbf gbdaf fcde fgdbcae gfbec | cbd geacdb adbcge dc
|
||||||
|
afegb adbfg becafdg dg bgd gaebfc fdge cdfba gbcead abfdeg | gd gbd dabfc defg
|
||||||
|
fabeg gd dfebcg dgfae bfgeca fecad adgb efabgd ecfdbag deg | gd cfead dcfea cbefgda
|
||||||
|
bfceag dafgb fdce fc cfg gcdebf becgfda dgbec aedcgb cbgdf | fc adfgb dgfab cgbedf
|
||||||
|
bfeg decaf cegfa ecfgab gcf dbfeacg caedgb aegbc dbcafg fg | bgdcfea fg bfdaegc afgcdbe
|
||||||
|
eac ae cbdfe cbaedf abcfedg bade aefcbg bdcgef cedaf gdfca | efcdbg ae bdfce cdefa
|
||||||
|
gdebfca bfgca fda bcafd ad gcda cfgdab fadbeg edfcb gcbfae | cgafdb fad fda acdg
|
||||||
|
gfbdcae afed gedac facegd bgeac de fgbecd cagfd ged bdgfca | bacge egbacfd adgfc deg
|
||||||
|
gdafbe dbacgf cbefag cbfdg bfdag fcedg cdbgfae adbc cgb cb | bc gadefb bc acbd
|
||||||
|
fa egcad acfed ebdcfa dgcbef daf bdecf fgadbc fbae gabdecf | cedfa egdcbfa fa afd
|
||||||
|
cfd fd gbafc dcagf daecg dbfa cbfage egfdbc bfdgcae cbdfga | ecbdgf df dabf fd
|
||||||
|
eafbdgc baegd fe bagfed aebfg cabedg efg facgb bdgfec fade | defa ef ef fdae
|
||||||
|
cfdeagb bdeacf eac gcdbfa egab egacfb cdgfe ea ecfga cgfba | aecfg dfbacge cae ea
|
||||||
|
aefcdgb bacfg cdg afecd gedbcf afgcbe abgd adbfcg fgdac dg | bagfc gbfcdea gfdac bgda
|
||||||
|
becf baefgd dcafg cb cdbage dcgfb bcg gdbef edbfcg egbcafd | fbce cbg gcbfde gefabd
|
||||||
|
gb bgedca fedga cfdeag fegb dcbfa gab afgdb acbgefd bdgaef | bga gb gb ebfg
|
||||||
|
dca cedbf dcfebga ca egbcad cdaefb fedag efdac acbf cfgdbe | fbcade cebfdag adc acd
|
||||||
|
bgdeafc gaefd fbeagc cdfa fgc degcf dgbafe gcedaf dgcbe fc | gfc egafd cf bcdeg
|
||||||
|
dfaeb fae ebacfd egadb fe gadbfc febc gbfeacd fagcde dcabf | beadg adefb fcbe dagfcb
|
||||||
|
fgaed gd dacgfb egcd gdf acfed adbfceg edbfca dcafeg baefg | decaf bacdgf fgd ebgaf
|
||||||
|
bcfeadg dfagce fdcgba dfcab gabec gcf gf abgfc bacedf bdgf | bcgfeda bdgf fg gf
|
||||||
|
ceab gafec cef fcdgba cbfeadg bcagf ce ceagbf agdfe degcbf | efgca efgca cef ebac
|
||||||
|
abgef abf gbeac gabfcde degcfb efdbga aefd bgdcfa af befdg | afbcdg fa bdfgec dfbgae
|
||||||
|
gdafce cfb agfbc ebaf fcebdg aegfc cbgfea egbfdca dbgac bf | fb abfe aebf dgecbf
|
||||||
|
ceadf fecag dcgaeb dgbfcea edc bcafd cdabef ed befd gfcdab | badecf ed egfca edfb
|
||||||
|
gecdbaf dbag bfade gabfed cedfba gfade cfaebg fgdce ag fga | bafgdce gacbef ga dagb
|
||||||
|
defbcg gbfce beag gacdf cfbaeg dbcfea ea cefga ceafbgd ace | aefcg ae aegcbf ebga
|
||||||
|
egbdac fgadb cefdbg aceg gc cedba dcbag ecafdb fgeacdb gcd | cg ecbad egdafbc cgd
|
||||||
|
bdac ac fcdaebg afbdeg dbagf fbcge acf cadgbf afedgc bgfca | cdab fgceb ac fgbac
|
||||||
|
ba eacfg cab aefcb cdeabgf ecgdbf dcbfe dbfeac acdbeg dfab | bacef adbf bfda cab
|
||||||
|
gbfca ceafbd geda gcdfae efbcdg fgced da degbcfa adf cdagf | aegd ad da geabcfd
|
||||||
|
fgdacb dg efagc gcd cgefab edcgfa cbedf gfdce eabgcfd daeg | dgc gdc cfedga cdg
|
||||||
|
bcadeg fbgaec ecdag gbafced ba bca edab bgadc fdcgae gdbcf | bcadfge edgacf bac dabgce
|
||||||
|
aedfb dbfcae caefbdg aefcdg gafcb dfcba bgfeda dc fdc edcb | bdfae cd eafdb cdf
|
||||||
|
cga afdebc gc adcgefb adbgf acgfde gcabd gbedac ecgb acdeb | gbce ecadb daebcg gc
|
||||||
|
cdf dcafg df cgade cebgad dcgfea fdacbeg dgbfec afbgc fade | bgeafdc feda edaf fbgac
|
||||||
|
fagbc dbag feadgc gfa dcebfg gbdcf ag gecafbd ceafb bagcfd | fadegcb gacfed defcbg dgcbaef
|
||||||
|
cadbfeg dbgace fcagd bedfca cfegd afgb bgdfca ga adg fdabc | dfcag gcedf cefabd fbadc
|
||||||
|
fgeabd egbca dfage fdagec fb dacbfe badgecf baf gfaeb bdgf | bfdg fdbg ebagc beafg
|
||||||
|
gbdaefc fa dgafb feda fegbdc dfbeg gaf cegfba gacdb badgfe | bagdf fa afg ebgcdf
|
||||||
|
bedc fbagd bdage cgdeab eba gcabef afcdge edgca be cfbgeda | geadb be dceb ebdgca
|
||||||
|
fe fceb acegdfb efg fdgce fagbed bedgc fedbgc dagbce agdfc | febcdg egdcfab dcebgf gef
|
||||||
|
fagdc ebacgd ecgdb decafgb cefbda geba bagcd bad fbdgce ba | ecdbg abeg dfbeac fgdaceb
|
||||||
|
decgaf cgab aedbc cbaegd ca bdegc fcegdab efabd cda cdbfeg | aedbf ebdaf cda dca
|
||||||
|
gafbde ecfda afdegc ecdgb ba cbfa cfadeb edabc bea ecbdfga | eab ecdgb bea ab
|
||||||
|
gbecaf dbgf facbgde cegabd gebdfa fdaec dfage egf adebg fg | gfe egf becafg abfgedc
|
||||||
|
gfceabd adgcb bcdf afb gafbd becafg bf dagef agbdec fgcdba | cbagfd fdbga dcbega dfgecba
|
||||||
|
ba afegdb cdab cfgeb facebdg fcabg cdagf fdgcab gab decgfa | cfbdega dacb agdcfb gabfdc
|
||||||
|
adebgc bdefcga afegdb bcedf bfg fedbg fg efga dbgea facdbg | gf gf debafg fgb
|
||||||
|
cegfda gfa ecgf gf ebgdac afcbd ecagd afebgd fcdag begcafd | fcabd dfacgbe fcabedg ceadfg
|
||||||
|
febgcd fcbda cdgab fcgbad bf fdcea dfb egbadfc bgcdae fbag | cedfa fb fb gabf
|
||||||
|
ebfag fcbade ad adec bgecdfa afd gebfcd bfdec fbade bgcdfa | adf ecad ebadf bdcgafe
|
||||||
|
cafbgde bdace cefadg gefcbd ag egdcf gae bcfaeg gcdae adfg | egabcdf cedga cedag adgf
|
||||||
|
agcef egcab fc dfeagb fce gbaefdc ebcadf aefdg adefcg gcfd | dfgc aebcg egdcfba agbec
|
||||||
|
db fdbcge dgb gfaced bfacgde dfba egdfba cabge edgfa gebda | eafbgdc db db gdafcbe
|
||||||
|
cad cdfgea caegbf agbd cbdef gbcdaf gadecbf ad bcafg dacbf | fgecba cgbfeda da dbecafg
|
||||||
|
bdegaf gfde gf bcadeg dafgcb afg bgaef eagdb cfbeadg fbeac | ebgad gfed debfcag fdge
|
||||||
|
bgac edgacbf dfbea cgebda gea cfedga agedb ag dcgeb fcedgb | dbage bdgacef cfagdeb deabg
|
||||||
|
caebd edf edgfbc fe abfegdc cdfea gfdac eacfgd gfacbd gaef | fega fgae gafe cabde
|
||||||
|
bfadegc dafec dbgaec abdcef fdaegc dag cagf ga aedgf fbedg | bcafedg ag ga adg
|
||||||
|
dcgfa dgcafeb cfb bf cegafb begcda fdgbce dcebg bfed fcgdb | dgcebaf bedf fb bcged
|
||||||
|
cbegd edfa fdc gadcfb gbcefad bgacef acfbe ebacfd bfecd fd | fdc dbgafc cefbd cdf
|
||||||
|
fgd dgbfe gf gcef bdecf dgcfba acfbde gdefbc badge facbdeg | dcfaebg fg fgd fbgced
|
||||||
|
abdeg adebcg ebafdc bgcadfe gedc ega bgdaf cabed efacbg ge | ge gae age afebgdc
|
||||||
|
debfa dfbga fagdc fbg cadgfe acgfbd efgcab cgfeabd dbcg bg | fgdba bg gfacbed ecabgf
|
||||||
|
bc egdba ebdacg cgba dabfec bec defcg cdbefga gbfead becdg | bcefagd bec cebfgda cb
|
||||||
|
deagbfc agebdc fbedca fa edgafc bfac adcbe gfedb afd efdab | fad dbaef cbfdae af
|
||||||
|
afgdeb beagd daecbfg gbfedc ecd becad egac agecbd ce fbcda | fbadge eacdbg cde ce
|
||||||
|
fgabec gefb cdagefb fbacgd dgecba adecf eg cefga egc gcfba | dafgbc gec bfeg gefb
|
||||||
|
gbcf fceag gb bag bdafge gbeac fdegca cfegdab egfacb daceb | bg cagfeb aedbc cbaeg
|
||||||
|
gbac fedagb gaf adcbf ceabfd abecgfd bfcdga ga edgcf gfcda | badcf fcedg adbcfg agebfd
|
||||||
|
gdbfc fbaecd gaef ef efb agebc gabdefc ebcgad facegb bgcfe | cfgdbae faeg efga cdegab
|
||||||
|
fbacge decgba bcafd fedgab fageb ed efgd ebafd gedbcfa bed | de ed bdafe de
|
||||||
|
bcgdf badgec de fecgd cfeag dfbe dcgafeb gdacfb ced fdbgce | de de edc gafbdc
|
||||||
|
gebfa fd dgacb dfgba bfdeca daf becfga edfg afgebcd gfadbe | bdcfea bafecgd acdegfb fgbdea
|
||||||
|
fgdcb efdcg gcfabd gcdbafe gbf acfb aegcdb edfabg fb gbcda | bgafde gfcbd fb cedbfga
|
||||||
|
de fadcg befcdg fbeac adcef efd ebgfca cbefadg edba dbaecf | eagbfcd beagfc bcefgd beda
|
||||||
|
ebcfad fbecgd edgba df adgfcbe dfe bcfaeg bedgf bcefg dgfc | df bcagef df aecfgb
|
||||||
|
acgdb gdc gcebdaf abcge ecgdfa egbd cbaegf gdacbe fcdba dg | egcfda aebgfc aegcbdf cgd
|
||||||
|
gc cge cgdb deafbgc dageb cbega agbcde cedgfa gbefad cefab | dabfeg gc eabcgdf gabde
|
||||||
|
abegc agecf adfcbge bcdaeg fbadec bca cb bcgd egdba gbafde | gbdc begad bfecda cb
|
||||||
|
daecgb abegd bagedf begfcd fe feag abefd bfe fbgceda fbdac | fbdac gcebdaf egfa fe
|
||||||
|
eafcbdg abcdg acegf dfcga fgaebc defcbg aefd dfc dfgace df | df adef fd dfea
|
||||||
|
fdecabg ba agebdc adb gcdea befdg gabc egdba badefc ecagdf | bda gcabde gdaec fgdcae
|
||||||
|
cdfg dbecf dg caebdf gbd beafg cbegfd ebcgdfa gdfeb agdecb | cedfb gd cbgeafd debgacf
|
||||||
|
bca cadbfeg gabfcd bcgafe caebg adgfec bc bcfe gefac beadg | cgefab cgfae befc acbegf
|
||||||
|
cabgdef cgabde efcab degcf gcfdeb da fgda cda feagcd aedcf | adc da cgaedf cgdfbe
|
||||||
|
dagfbe gaefb efcgadb fbcae fg gbf edbag cbgdae gadfbc gfde | bgf gf acgdfb cfgdba
|
||||||
|
cbedag edgca bfcagde gfbae gfdea df adfc dafceg fedbcg gdf | adecg gbafe acdbfeg df
|
||||||
|
ebfc ef gecfad gfdcb egbad gfabcd ecgdafb feg bfgdce dbefg | aegdb bfged ef bafdgc
|
||||||
|
ce cefd cafdg cdgefa geacbd eca gcbfad gebfa afecg bfedcga | ecgfa cea defc ce
|
||||||
|
ceb edbgafc fabec cb dfagec fgbea daefcb efdca cebgda bfdc | bec eadfgbc degabc adgfce
|
||||||
|
cgf aefbdgc gf bagf gedacf ecgfb cdfeb acgbe ebcfga cedbga | gf fbgcade cbegfda acbdfeg
|
10
aoc2021/input/day08_provided.txt
Normal file
10
aoc2021/input/day08_provided.txt
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
be cfbegad cbdgef fgaecd cgeb fdcge agebfd fecdb fabcd edb | fdgacbe cefdb cefbgd gcbe
|
||||||
|
edbfga begcd cbg gc gcadebf fbgde acbgfd abcde gfcbed gfec | fcgedb cgb dgebacf gc
|
||||||
|
fgaebd cg bdaec gdafb agbcfd gdcbef bgcad gfac gcb cdgabef | cg cg fdcagb cbg
|
||||||
|
fbegcd cbd adcefb dageb afcb bc aefdc ecdab fgdeca fcdbega | efabcd cedba gadfec cb
|
||||||
|
aecbfdg fbg gf bafeg dbefa fcge gcbea fcaegb dgceab fcbdga | gecf egdcabf bgf bfgea
|
||||||
|
fgeab ca afcebg bdacfeg cfaedg gcfdb baec bfadeg bafgc acf | gebdcfa ecba ca fadegcb
|
||||||
|
dbcfg fgd bdegcaf fgec aegbdf ecdfab fbedc dacgb gdcebf gf | cefg dcbef fcge gbcadfe
|
||||||
|
bdfegc cbegaf gecbf dfcage bdacg ed bedf ced adcbefg gebcd | ed bcgafe cdgba cbgef
|
||||||
|
egadfb cdbfeg cegd fecab cgb gbdefca cg fgcdab egfdb bfceg | gbdfcae bgc cg cgb
|
||||||
|
gcafb gcf dcaebfg ecagb gf abcdeg gaef cafbge fdbac fegbdc | fgae cfgab fg bagce
|
68
aoc2021/src/day08.rs
Normal file
68
aoc2021/src/day08.rs
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
use std::fmt::Write;
|
||||||
|
|
||||||
|
use anyhow::{Context, Result};
|
||||||
|
|
||||||
|
const INPUT: &str = include_str!("../input/day08.txt");
|
||||||
|
|
||||||
|
pub fn run() -> Result<String> {
|
||||||
|
let mut res = String::with_capacity(128);
|
||||||
|
|
||||||
|
writeln!(res, "part 1: {}", part1(INPUT)?)?;
|
||||||
|
|
||||||
|
Ok(res)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn part1(input: &str) -> Result<usize> {
|
||||||
|
let entries = input
|
||||||
|
.lines()
|
||||||
|
.map(TryInto::try_into)
|
||||||
|
.collect::<Result<Vec<Entry>>>()?;
|
||||||
|
|
||||||
|
Ok(entries.iter().map(Entry::count_easy_digits_in_output).sum())
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Entry<'a> {
|
||||||
|
four_digits_output: Vec<&'a str>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> Entry<'a> {
|
||||||
|
fn count_easy_digits_in_output(&self) -> usize {
|
||||||
|
self.four_digits_output
|
||||||
|
.iter()
|
||||||
|
.filter(|digit| Self::is_easy_digit(digit))
|
||||||
|
.count()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_easy_digit(digit: &str) -> bool {
|
||||||
|
matches!(digit.len(), 2 | 3 | 4 | 7)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> TryFrom<&'a str> for Entry<'a> {
|
||||||
|
type Error = anyhow::Error;
|
||||||
|
|
||||||
|
fn try_from(s: &'a str) -> Result<Self, Self::Error> {
|
||||||
|
let (_, output) = s.split_once(" | ").context("couldn't split on ` | `")?;
|
||||||
|
|
||||||
|
Ok(Self {
|
||||||
|
four_digits_output: output.trim().split(' ').collect(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
const PROVIDED: &str = include_str!("../input/day08_provided.txt");
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part1_provided() {
|
||||||
|
assert_eq!(part1(PROVIDED).unwrap(), 26);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part1_real() {
|
||||||
|
assert_eq!(part1(INPUT).unwrap(), 488);
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,3 +7,4 @@ pub mod day04;
|
||||||
pub mod day05;
|
pub mod day05;
|
||||||
pub mod day06;
|
pub mod day06;
|
||||||
pub mod day07;
|
pub mod day07;
|
||||||
|
pub mod day08;
|
||||||
|
|
|
@ -9,6 +9,7 @@ use aoc2021::day04;
|
||||||
use aoc2021::day05;
|
use aoc2021::day05;
|
||||||
use aoc2021::day06;
|
use aoc2021::day06;
|
||||||
use aoc2021::day07;
|
use aoc2021::day07;
|
||||||
|
use aoc2021::day08;
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
let days: &[DayFunc] = &[
|
let days: &[DayFunc] = &[
|
||||||
|
@ -19,6 +20,7 @@ fn main() -> Result<()> {
|
||||||
day05::run,
|
day05::run,
|
||||||
day06::run,
|
day06::run,
|
||||||
day07::run,
|
day07::run,
|
||||||
|
day08::run,
|
||||||
];
|
];
|
||||||
|
|
||||||
aoc::run(days)
|
aoc::run(days)
|
||||||
|
|
Loading…
Reference in a new issue