A day08.lisp => day08.lisp +148 -0
@@ 0,0 1,148 @@
+(defpackage #:advent2021.day08
+ (:use #:cl #:alexandria #:cl-ppcre #:advent2021.util)
+ (:export #:solve-part-1 #:solve-part-2))
+
+(in-package #:advent2021.day08)
+
+
+
+(defparameter +input+
+ ;; (signals outputs)
+ (parse-lines
+ (lambda (line)
+ (destructuring-bind (signal output) (split " \\| " line)
+ (list (split " " signal)
+ (split " " output))))))
+
+(defun solve-part-1 ()
+ (loop :for (signals outputs) :in +input+
+ :sum (loop :for output :in outputs
+ :count (member (length output) '(3 2 4 7)))))
+
+;; 1111
+;; 2 3
+;; 2 3
+;; 4444
+;; 5 6
+;; 5 6
+;; 7777
+
+(defun find-signal (n signals)
+ "Find the signal from SIGNALS with the provided number of segments"
+ (loop :for signal :in signals
+ :until (and (= n (length signal)))
+ :finally (return signal)))
+
+(defun one (signals)
+ (find-signal 2 signals))
+
+(defun seven (signals)
+ (find-signal 3 signals))
+
+(defun four (signals)
+ (find-signal 4 signals))
+
+(defun eight (signals)
+ (find-signal 7 signals))
+
+(defun zero (signals one four)
+ (loop :with sig3or6 := (char one 0)
+ :with sig6or3 := (char one 1)
+ :for signal :in signals
+ :when (and (= 6 (length signal))
+ (and (position sig3or6 signal)
+ (position sig6or3 signal))
+ (not (loop :for seg :across four
+ :always (position seg signal))))
+ :return signal))
+
+(defun six (signals one)
+ (loop :with sig3or6 := (char one 0)
+ :with sig6or3 := (char one 1)
+ :for signal :in signals
+ :when (and (= 6 (length signal))
+ (xor (position sig3or6 signal)
+ (position sig6or3 signal)))
+ :return signal))
+
+(defun nine (signals one four)
+ (loop :with sig3or6 := (char one 0)
+ :with sig6or3 := (char one 1)
+ :for signal :in signals
+ :when (and (= 6 (length signal))
+ (and (position sig3or6 signal)
+ (position sig6or3 signal))
+ (loop :for seg :across four
+ :always (position seg signal)))
+ :return signal))
+
+(defun seg1 (seven one)
+ (loop :for seg :across seven
+ :while (position seg one)
+ :finally (return seg)))
+
+(defun missing-seg (signal &optional (out-of "abcdefg"))
+ "Find the segment from SIGNAL that's missing out of OUT-OF."
+ (loop :for seg :across out-of
+ :while (position seg signal)
+ :finally (return seg)))
+
+(defun seg6 (one seg3)
+ (loop :for seg :across one
+ :while (char= seg seg3)
+ :finally (return seg)))
+
+(defun segment-map (signals)
+ "Return a string of segments that map to its respective locations."
+ (let* ((one (one signals))
+ (four (four signals))
+ (seven (seven signals))
+
+ (zero (zero signals one four))
+ (six (six signals one))
+ (nine (nine signals one four))
+
+ (seg1 (seg1 seven one))
+ (seg3 (missing-seg six))
+ (seg4 (missing-seg zero))
+ (seg5 (missing-seg nine))
+ (seg6 (seg6 one seg3))
+
+ (seg2 (missing-seg (coerce (list seg3 seg4 seg6) 'string)
+ four))
+ (seg7 (missing-seg (coerce (list seg1 seg2 seg3 seg4 seg5 seg6)
+ 'string))))
+ (coerce (list seg1 seg2 seg3 seg4 seg5 seg6 seg7)
+ 'string)))
+
+(defparameter +segment-table+
+ '((1 2 3 5 6 7)
+ (3 6)
+ (1 3 4 5 7)
+ (1 3 4 6 7)
+ (2 3 4 6)
+ (1 2 4 6 7)
+ (1 2 4 5 6 7)
+ (1 3 6)
+ (1 2 3 4 5 6 7)
+ (1 2 3 4 6 7))
+ "The segment locations that map to each digit.")
+
+(defun output-digit (output segment-map)
+ (loop :for seg :across output
+ :collect (1+ (position seg segment-map)) :into locs
+ :finally (return (position (sort locs #'<)
+ +segment-table+ :test #'equal))))
+
+(defun output (outputs segment-map)
+ (loop :with n := 0
+ :for output :in outputs
+ :do (setf n (+ (* n 10)
+ (output-nums output segment-map)))
+ :finally (return n)))
+
+(defun solve-part-2 ()
+ (loop :for (signals outputs) :in +input+
+ :for segment-map := (segment-map signals)
+ :for output := (output outputs segment-map)
+ :sum output))
A input/day08.txt => input/day08.txt +200 -0
@@ 0,0 1,200 @@
+gabfed acbdfg cd gebcd gdfecb bgfdcae ecdf dcb gdbfe gaceb | dcb dgfceab cbfdeg edcf
+cdbeagf df bfcgd bfed cfd fgcbed gcedb cfeadg cegabd fbacg | acbfedg acbfg dfcaeg bfgca
+ag agf fbaceg beag acgfe efdcgba afcgbd afced gfecbd bcfge | bcfeg bcdgfae fga egacf
+gdfcea edb acefgbd bgcad gabed cdbfea adgef ebgf dabfge be | gdbca be egfacdb adcefbg
+dbefg ba edfca fdebga abf ageb fdcagb fbdae cfeagbd dfbcge | ecfda bfa fdgeab fadbcg
+cfbage be daecf cedbfag dcafeb eabd ebc dcefb dcgbf gefdca | deafc fbdec gecdfa dfgcb
+bdcaeg gde fdeb gadfe ed gfdca febag begadf aedgcbf gcfeba | fbgecad egbcafd fdcag ed
+cg gbfad gebc fbdec bdfcg efbgcd efbdca cgfdabe cfg adgfec | befdcag dcbfg bcedf cfg
+gefc faedgc adegf fea gcbade fe dgafb fdecab cadeg cfaedgb | dbafg gdebca dbcaeg bdacfe
+gdfebc abcefd bcged dgcf efdgb gbfcaed adcgbe bfgae efd df | agfbe cgebd agcedb feagb
+fgadec egbf fegdab ef agecdfb baecd fbdae bfadg gdfacb dfe | cebda ebcad dfe efd
+acfdge cebgf fbag aegbcf gfc cebgd fg abdcef dcfabeg bcfae | gfba eadbfc efcabg dcgaef
+cdfeba bcdage gbcef cdbaf cfadebg dcgbf fgda dg bgfcad dcg | edafgcb gebdca gd cegbdfa
+cb cebadf ecbadgf dbgfa cfb cgefd dcfagb dfbcg fdebag acgb | decfg dbgcf fcb adefcb
+baedg eafdgb af gfcbd abf bfagd egaf gbecdfa eadcgb dcfbea | gbedfca af gcfbd baf
+cg cag gacbe eabgfdc egcbda dgce gdabfe begad agdcfb ceabf | gbfcad bgaced febdag debgca
+dabg fdgbc efabc ag afgcbd bcfag fag dbfgaec cfegdb facdge | cfagb fcdbga gaf fag
+feabd cgfadbe gdebcf adecb bf fdb abfg dgaefc gefad badefg | bedgacf bfag gdeaf gafb
+edfcb becgf eg cbagdfe gfcab egf febcda gfeabd dfebcg cegd | gef ebfdgc gbecf efg
+dcgbae fegbac ecg abgcdf bgdca eg gbed cegfdba daecg dfcea | dbge decfa gecad cdfabg
+bdg cabdge edagb cgde bgaedcf bdace gbacdf egfab bfdeac dg | acedb gbdeca daebc gdec
+gcdab fbacdg fbca edcbag fb cabdgef cfbdg cfedg fgb fabdeg | bafc bacf gfbaedc cgedab
+gacedf fcadg agd dgbfea ad gcabf acbfedg fgdec edca cgdefb | adgfc deagcf ecgafd fbcag
+defgba cedagb cbgadfe gfcdae faeb fbegd feg geadb dbcgf ef | cbfdg feg ef gef
+abgdef fgcbda cafbd gbfc bf bacde bfadegc degafc cgadf fba | bf bcgf ceadfg decba
+bfgcad efcag cgdaf dfaegc cgadeb eg egdf gae dfcbgae cabef | fabec feadgcb edcbag ega
+bdfea fcab ac eadbcf egdabc bdagfe dcegf dfaec ace gcbafed | egbdaf ca bcaf dafbe
+ba gafb adbeg acdfeg dfgae begdc eab dgacfbe eagfbd ebfdac | dgcbe eabcdf eba bcafgde
+gfaceb dgfae ca dcfgab dgbcfe fcage bgecf fgacedb cbae fca | bgcfda cafgeb afegc fgace
+gfcda egfcda cdabeg gabfe db dfbc dbg bcfadg dfabg bfdagce | abgced db dfbc bd
+gdafce bafde cbdfa fea bcgdae bgacfde adbefg bedag efbg ef | ebcgafd gdafbe cegabdf cgfaebd
+adfgc bcge acdfbeg bac cb cgfab ebfga adfbeg fcgeba dbcfea | abfgc dgbafe fcdag fcagd
+ce gdbfcae bcgadf cegfad facbe bdce bdcfa aec aefgb afecdb | fedbac egdfabc bdaecfg eabdfgc
+bfeda fa geafbd bdgef fda cegbdf bgdface gaef cebad cgadfb | adegbcf efag dfeabcg edbgcf
+def gcbfd ed ecgbdfa gdefc gbed cadebf cgfae cgdfbe fadcgb | ed fed cbfgda fbceagd
+gec agced agef edbca cfdbga dacegf ge baedcgf cafgd cgdefb | fbgcda bcgaedf cgead gce
+eabcgd gecbadf bge ge acgbd egad fagcbe fcdbe ebcdg dcgbfa | cebdf geb fedbc geb
+gaecfd gaf cfge cbefad fgcdaeb bgefda dbgac dacef cdfga fg | deafcb aedcbgf fg fdcae
+acbgef dcbgaf caegfdb be afbcg gafbe bfe ebcfad gbce dfega | bfe decfab fcabde cbegdaf
+eafcdg dbgac efgd fcdae eg gadce ecbagf eag efdcba becfagd | gdfe ge acfed aebcfdg
+dacegf cbae ac gfbdaec agc gbdfc gbcaed bgead acbgd efdgab | ca ac ac gca
+fcd cafe bcade efdcb fc bedfca fgbcdae egbfd cbadfg gadbec | bdgef cf aecf cdf
+abgcf bcgafd ge abgdecf edcfa cge cgafe gbae bgcafe ecbfgd | gabe adcbgf gce fcabg
+ebfcgd bdeagfc dgbefa fegcd fa ceaf fga dbgca adcfg adecgf | gfceda acgbd af ecgdbf
+gabec cgefda efbacd egabfcd bf fba agdfc bfdg bcgfa bdgcaf | afbgc afcdbg acbgf ebcag
+begdc gecfd cbgfad cfgda egabcdf fe aefc eadgbf cgefad dfe | afce fe cefa egdbc
+efdcag bgcad dbeg dbfgaec ebadc fgabc gd aedbcf dcg cbadge | gd ceabd agbdec gebd
+aegb bfcag agcbfe agfcbed bcdfa fagce gcb gb bcfdeg dagcef | bcfedg bgae acefgd cefga
+dcfagbe adg ebacgf dfbeag ad fcagd abdc afcgbd cfbag cfedg | dfabgce da cafgbe ad
+ead degcb eacgf fbecda adbg febdcag ad bcgdae cgdebf egacd | cefag cdgae fbdgec agcfe
+cgbaef bagecfd adbgcf adfeg faedcb fcabe cegfa bgce fcg cg | gacef bgface bdgafc fbaec
+acfgd gacbfd bdegfac fcgedb da cadb efgdab agefc fdgcb adg | adg ad aecgf bcgfd
+fgdcea fbacdeg cefda dag fedg dg gacbed fbagc gfcad fcedba | gd dcfebag cdafbge gebfdac
+bcafeg gaefcd cae gcade ecdf ce dgafc degba gabfdce gbafcd | bafgec gacfdb gdcebaf cdfgab
+fcgb afgdec bdecf fg dfbaec cgbfdea dcfgeb dfg ebfgd abdeg | dbega eadcgf febdc cbdgeaf
+adcf agdecf dgeac gfcdbe faceg gfceba begdcaf gcd daebg cd | fadc dgcefa ecgdbf acegf
+gedfa gbdea bfgade ebcfdg gcedab eabgcdf ef fge bfae cfdag | baef gfe egf degcafb
+aedbcf beadg dcgfbea gaecb aedgcf bagefd bed fdgb db degaf | bgfd fegadb bgdea acbfed
+fbgca da defbga cebdg bdcga efcbag fgdebca bda fcad bafcdg | ad gcbaf dabgc gbedc
+cgeb cfgda eg fcbedga acfebd badegf gea daecbg eabdc caged | ebdac gae bceda dcageb
+ge bcdfga cbaedgf gfe gcdfb efgbda febgcd cgfbe gdec afbec | dcge cdge ecdg gbdcf
+dcabe ebfgd gda dcfaegb afecdg dageb gbac ag dbcgea acefdb | gda dag gbeacdf ag
+gadf fd baedgc gdcba efcab fdb fbdceg gbfcad adbfc daebcfg | dfb fgda bdf cdbgea
+bcdfge dbfaec gb bcdef gdeb gcb bfcage fdcgb gafbecd dcgaf | bg bgcdef dbge befgdc
+acdb gecbdf cgafb dgbfae dcbafg ab dbgcf adbfegc fab acegf | dcbfg bdca cbgdf dgfcb
+acbdfe cabe acdbf badcefg cdbgf ba afb gfcade gedafb fcaed | bfa gbdaecf ba adecf
+ae bdafc bceaf gdbafec bfgec eab dabfge fgbdca daecbf eacd | ae becgf cead bfcea
+bcged dec bfceg acbd faecgdb daebg dacbge dfaebg gfadce cd | ecd dc gfcbe adbfeg
+ecadfg bfdge fe fde bagcfd fcbe bgfdc geabd bfcegd dgbcaef | fcadgb bgade fe fegadc
+degabf face fcd cf bfdegc adcefg cdgfa cdagebf afdeg bcgda | fcdebga fc caegdfb feadg
+dfage dfec df gabced eacfdg fdg fgbecad cadeg gfcabd aefgb | cdef fegdac fd agfeb
+da bfgac adf gefdc cabfgd bgfeac afebgd cgfaebd cgdaf adbc | fda dfgce gfabce faedbg
+dgfba gadefc acegdfb bgd bg cgba facdg bgdfca febdgc eadbf | gdb dagecf fbdgac dafgb
+ab gecaf ebfadcg bagfc cbgfd dcfgea cab efabcd eagbcf abeg | acb fbdeac abc agfebc
+gc eagfb gec aegcbd acfed gdbceaf cgfea dcgf cgefad cdbfea | dfgc gefba cg aedcfb
+deafc gbcf bfdeg dcafgeb efdcb acbged fgedcb cbe bc gefbda | cdfea fbgc fedcb ebfcdg
+cd dfaeg dgceba gdcebfa gcfde gbdfce dcg fbgce ceabfg bdcf | cd dc fcgbe deafg
+fd cfeab bdecf abdgec fdbecg dbfg def faegdc fagcdbe bcged | edcgb fd fegbdac dcebf
+gcfbd fa fbadc abgedc cadfbeg fda afbe bcead dcafge ebfdca | fdgace gefadbc acbfd befa
+bgcedaf afbegc eg dfbeac ceg fgcdae efcda ecgdf gcfbd daeg | decfa deag gcdfe ge
+cgabdf af abfe agedbc ecfdg bgdea fagbecd fadbge dfa dgeaf | fa dbagce af af
+egdabfc dgbac gefdca bcef gcfbed cf dbgef dcfgb fdc afbedg | becf gdeabfc dbfgcea efbgd
+feb abegfd agfedc cbfge fagec bf gcbde afcb aefgbc gfbecda | bcfa bf fb egfacb
+fage cgbfd gcfde gedfca fce fe adcge dafbceg aecdbg cdebfa | fgae gaef cfeabd cfdbg
+gdcfe ed eagdfb dcfgbe bagcefd ebcd fdbgc deg gecaf gbdafc | gebdcf efgdba gcfebd de
+debfga dcbe bcaeg aecbgf acedg ed dbgcae dgecfba cagdf ade | geacd ecbga de becadg
+abegc fe efbdca aecfg adfgce efa bgafcd gdef gfadcbe fdcga | ef dcgbeaf fgcad faceg
+adgfeb fbcge fbacgd acb abdcef ca ebcaf faedb caed gcbeadf | afecb acbdfe efadgb cbgfead
+cefa daefbc fdecb aefdb gfbceda bgdafc debfga bgedc fc cbf | bfc ecfdba adefb ecaf
+debc dfbage caedg cafedgb fbacg gbd agbdc gdafec db deagbc | bd bdg befdag dcfage
+gacefb edbac gdef gfbeacd gfecb gacbdf fd dcfeb bgefcd cfd | cgbedaf gdfe gecfb cfd
+geacd eb ebg gfbcade egfcdb daeb dfacge eabcg fabcg cdabeg | gdcaef ebg beg daeb
+gadbfce gfda abcgfe gd bacgf abdce dgb dacfbg dbagc fbegdc | ecbafg bfgac gcbfa cbgfde
+aedgcb cdaef efg egcba fcage fgbeac daefgb bfgc gf gcbeadf | fecga edagbc gf bdefagc
+db cgebd efbgdc egfcda ebdf gecfd fdebcag dbc abfdcg gabce | db cedgbf aecfgd debf
+ecfadg efbagc feg cgde fbcdag ge gadef bcgadfe cafgd aefbd | fbgcae afcdebg edfab eg
+gebfad bgeca fdce bdgceaf cd debgc bcd dbgfe bdfcag bfgdec | abgec cbage facdgb dc
+dbfgcea eacg edacf dfgec bgdcfa daefb fedbcg cad ca eacdfg | cad ebgdcaf cage eafdc
+decafg abdcg bgdcfae fa daf bedfcg cfdba cfdaeb abef fbecd | dbafgce afd fa caedfg
+dfcbgae fgecb abegdc beafdg ecd efdgc cfeagd cdfa eadgf cd | egdaf cdfa decgaf cdaf
+gbafed cegfadb cage efcabg cgabf gfebc dacfb bdefcg ag gaf | fgcab fbdgce bgacf agbfcde
+badgc bea be adcfbe dgbecaf ecgb cdgbfa dbega gdfae daegcb | cebg adgcbf bcdga agbcd
+gbaced fadcb ag dfebgca gac bdgfec acgbd gdceb aegd gcbefa | adge gaed gca ecbdg
+bgdce gbdcfe ge badec gacfbd egb fdcbg fgaecbd fcbeag dfge | gfed cefgbda ebdgc gcbdf
+aedfc cgde cgfaed bgfad ge bcfaed ecgabf gae egbfacd geadf | fdeag febcda cedg cafdbe
+agf fegad fdgcae fcead fg abcfed cfeg agdbe fcbdga degbfac | adebg ecfda afg fg
+bdfegc aefg bacged fegdbac fgcad cbfad ag agd fegdca fcedg | feabcdg bdcefg gbfacde edgfac
+aec cefbag dabfgce dgcae degacb ae bgced dbea fedcgb fdacg | ecgbda ebcgd daceg cedgb
+dcbfgea decba fadegb ebfag cef fagbec fc bcgf ecdgfa febca | bgeadf fgebda gcdafe abcde
+bfcgd degfbac afebc def cfdega ebgd ed bfced cedbgf fdcgba | dgbcef fdcbe gafcdb gbfdec
+fge abfcdeg dfega fg eabgd fdgc fgaedc ecadf becgaf befcda | edgaf fcdg dbfcea bcefdga
+bgcafe bdfecg acedf dcfbe agcdfb be bfcegad fbe ebgd gcdbf | fbe feb bedcgfa fdbce
+be cabdfe adgce fbcda cfeb aeb acfbegd abgfed ebdca adgbcf | egadc eb fcadeb bcedaf
+gfbea ecbf gcefa ec cdfag fdgeba aec eagbcd bcfgae afdgcbe | gbadcef afcbegd acgef dfgbea
+gb dgbf cegfda bfcgae dceba afcgd cagbd afdebgc gcbdfa cbg | bg fbdg cbg bacgfe
+efgdcb cgefabd fc abedc bgefd deagfc cbfed cbfg ebafdg fce | febdc fgedcab bcdae fdcbe
+cafbdg gdebc beadf dca acebd ac fgdeba ecfabd gdefcab ceaf | efdcgab gabefd dcgbe gdecb
+fbd adgbe fegcb afdcbg dcfgbea egfdb fdce fd fdbgec caefbg | edfc afbdcg abfegc fdbeg
+cbgdaef eabdg afdb cbdeag ecfgb fd edfgba fcdage efbdg def | dgfcae dgebf bcadge fd
+eb dfcge deb cbgdfa abef baefdg abdgf fbdeg fbcgade agbcde | afeb dfgba agebcd dbeagc
+gcbde eadfbc gbeda edcbfg ae aedbcg afcgbed afgbd dae agce | cbegd bafdg bdega gbadf
+faegc adbcfg bgfaec edgcb geadc dafgebc ad dfae ecfdga cad | acd da fcbgea gdceb
+ga daecfb afgbdc dcaef gcfbe gedafbc edafgc cgafe agf gaed | ga fcbadge fdebgac egacf
+cdgfab gaedb egfbc ebdfag dgc dc ecad eacgdb dfegcab bcdge | efgbc dc gcd gcebad
+edcfg befacd cdgae bcgfed dae gfad agebc bdcfeag da fcgeda | fgad edbcaf fcadeg ceagb
+ba afegcd edcfb cba baefcg fgba acdgbe bgafedc ebacf ecfag | gcadfe cfdbe cgaebd beafcg
+cegfa edcb be cafeb fagdbec fbecda cdfab dagbcf dgeabf feb | aebdfgc eb bdec cbaef
+efdba bacde dce dc beagc dcfb dagbef adgfce afedbc dgafebc | dce deacbf dbaec dcbf
+fcdebg ce caef dabef eacbd gaebcfd ecb dbfcae cdgab defgab | dabgc ceb cafe bfdea
+ebdcagf gefcb bafe aecgdb be fgeac geadcf cbe dcgfb gbacfe | bce be gdfcb eb
+bfgead deacb fae fbcdag fe defgbac baefd bgfda gdef bacgef | aef fdgab fgcabed dabgcfe
+bg fgadec debg fbg cadfb dgafebc eagfd dabfg fbegad gfecba | bacfge egcabf gafdb dacgfe
+bgdce ecba abcdfg gbe bafged cfdeg eb becfdag bgadce cabdg | egb bace fedgc facdegb
+gbade agf efac fgdaecb gcfabd bfecg bcfgea gdbfce fa gfaeb | gdfeabc febagc fa afce
+bfcegd fbdeag ga dcabeg egfa dagfb efdgb dbcagef dag fcbad | bcfgaed edcbgf dga dacgeb
+bdcfga db gadcfe bgdcf gfceb cadbge adfb cbgdfae bgd dfagc | gefbc dgfaec cgfeb db
+degabf gbea ecfbd gdfbac aed fcegda gdbaf ebfda ae edfabcg | bcfed ae dgfecba dgcfae
+begaf agdbfc fagcb be edgfbca efcb afgde bae gfbcae agcedb | be efbc afbgdc begdac
+afebg ecfab becfd gbaefc cgfa ac edacgb bedgfa febcgda aec | fecbd cbfeag efabg gbdeaf
+cfdage ef dceagb feda fce ecadgfb ecgad gcfde gfbdc ecfbga | dbfgc efad fead bgdcaef
+agdbef fb bcedfag cgdba bdegcf fgead fbd gfadce befa bfadg | dgabc fb dfb bf
+cfebgd cabdf dgcaeb egcbaf ae cea eadbc fedbagc aedg cedgb | gecdb ace aec ae
+cbe bgaced cgfba baef fgabcd fgcde fgabce eb efbcgda bgfec | abgfdec bgafc badefcg ebc
+ecagb dfce cf fbc dcagbf befca acedfb gdeacfb eadbf dgafeb | fedgba dfcabe cegab ecagb
+fa agbdc cgdaf aedf efgcd efdacgb gbcfde afg acdgfe gfabce | fa gaf fead fgecd
+egacb cgbdaef ce bec gbafc dgcfab egbda dfebac fceg ebacfg | gbcea acbdef caebgf efdgcab
+dafeg cd febadg acefb agcd bfcgdea dcfgae ecdfa ecd dbfegc | becaf dgac becaf egcdfa
+badc bc cfaed ceb dbgfeac gadefc fgeab fgbedc acbfde abcfe | afegb efbdca cdfbea bdegcf
+bafedg dgbceaf gcdef dfeabc abfdgc gcab cfb cdfgb dgabf cb | bc cb fgdba bcf
+dfabg dfgbca cd bagdefc afbce gdacef bdcg dca bafcd efadgb | dca bcadf bdgfca adfecg
+acgbd acfgde fbgedc fbgcdae fdcabe fdcge fcb fb fbge cdbfg | cbf gfdec fbc acfdeg
+eafbdg eadbgc bde gcdbaef gdceaf ecdag fgecb cgbed bd adbc | aecgdfb bd cgaed dbe
+dg fcaebg gbeaf gcdfea fgd fgdab cfabd ebdg fcdgbae gbedaf | fagbce dcegaf afecbg cegbfa
+gbd efcagd gb bgeda fbade bfecgd eabdgc daceg gfecbda acbg | egbfcd fegcbd egdba aedgc
+bag efbgad ecgdab edabc adbcg agec ag feabdc dgfcb efbgacd | febdcag cgdfb agb gdcab
+fegdabc becafd dcefa eagdc bcfae fd fde dafb febcag befcgd | cbdfea fbda edf fed
+gdcbf cafbeg bgdface ad eadf eafbdg fdgab gdbcea egbfa dba | gbfeac ebagf bdacge gbecad
+ebfcag ecfgadb efbagd egb dbfagc cbfe be agebc bfacg agdce | beg becf gcbaf bafgc
+bgedca eacgf dec afebcd dc bedag adgbef ebcgdfa dgbc cdgea | agbdfe ebagd dce bgdc
+adecgb bdeaf gdefa gdbfeca fgbe aedcbf egd eg cfdga afdbge | dcfeabg cfgad gefad gfbaed
+cafe ce abecdg edc bdcfg afcdgeb beagfd ecdfb bfcdea fdeba | ce face ce ecd
+gf efadc gafcde cfagd cgf deafbc dgef bcefag gbacd dagbefc | efacd fgc cedaf agdcf
+dgfebc bad ba eadgb agecdb gadfe abcg cgfaedb gbecd ebcdfa | ab cfegbd ebdgac bcfegd
+baegf gdafe gedb edafgb gfaecd ceabfd eb abe gedbacf fagcb | fabgc fgdae egfad eb
+dbfeac bcegaf cabfdg fbcga abgedcf dbgc aegfd db fbd afbgd | dcbg afgdcb dcbafe dabgf
+df dfa fbdae becda agbfe gfabde gcefad gdfb fgcbea abfegdc | daf dgfb fdgb aebcd
+adebf ec cfeda aec gefdca gdcaf dgfaecb fgdbac cegf bdcega | ecgf cae faedc edbgcaf
+de efcdgab gcdabf deaf gbfad bdecgf dbe bgaec gabed ebdgfa | cfdbgae bcgfda de bfadg
+gdefca fedacbg fc abecgd bafgd febdca cbaed acdbf ebfc dfc | fbcad dfbacge baedgfc feagdbc
+gfdce fecdgb ac daceg fdac beafcg ebcfdga gbdae agc fgceda | cga efdgc gaecdf bcgfea
+agebdfc ebgfad deacb eab edgfca cbfa afced ba cfdeab ebdgc | ab bdcge aecfd aeb
+gbaf gadecbf gbcad bdcfa gcfbad bf cfade bfd dagcbe cbgdfe | dbafc bf fbacd bfacd
+dbegc dfecbg cfd geadcb cgfe gbdaf fc abefcd aefgdcb fdgcb | cdgbf cf fadbg dfc
+gdfea cgbfd bfca cedbga bfadcge fecdbg cgfabd ab bgafd dba | fecdagb agdcbf bgcedf cfebgd
+gbacfd de ecgbfad gedabf ecadbg dea dagcb badec edgc efabc | ed ed gdce gdfeba
+fgdeb bgc gcdaf daegbf aegfcbd baefcg gcdfbe bc fgbdc cedb | gacfd gcadf gbfdc gcdaf
+daefbcg de cgadfb aebfg cfeadg edac efagd afdgc dfe ecfbdg | geafb cdgaf ed fde
+ega cbgda dfbea afgbed bedafc febdgca ge cfgbea dgabe fgde | dfge gae egdba agcdb
+gfdcb fdbe be aefdgcb ceb abdgec fbgdce ecgaf gcdbfa gecbf | cgeaf cgfae bec gdcaeb
+dafeg bead fad cfgea da dgbfe acfbdg fdebga bdgecf fbdgaec | gaefc cdebafg ad gcafe
+fbdca ec agebf ecf edac febgcd bgfadce fabcgd debfac cebfa | cadbfg fec fedcagb bacfgd
+afbdge bgfadc adgfce fdega cd cbaef decfa dbacgef edcg dac | edabgf gedc cfdega dca
+bagecf fecdab aecbg cf efgbdac ebdgac fegda fbgc cfe gceaf | fc cf gcbea cef
+fcadbe aedbfg afdbc dfegcb acfe fbgedca bcdag fc edfab bcf | edfcagb cfdab fedcgb acfbd
+daecb dgab dbgceaf feacb cgdeab da acd adecfg bedgc efdbgc | fgeabdc eacbd da ad
+efd adefcb ed fagced dbagfc bafgcde fedag cegd faebg gcdfa | eadgcbf gfcda fbadec fagdc
+edbgc cbagfed cgbdfa ae baged dgfba bfea fegadc ega fgaedb | dgafebc dcgbaf gdebc cebdg
+gcd cg fecg bgead bdecg fgcbad fgbdce decbgaf bceadf dbfce | bgeda dgbea bfcdag fecg
+bcaged fgcbed ecaf bae cgfebda fbacde ea eafdb bdafg dfecb | acbdgef dcefb dbfaec fadgb
+cdb defc abgfc faegbd dbacfge cdbfea gbceda dc bafcd afbde | fadecbg cd cd fbadc
+dgfce eafdcgb fcgae gabdcf gde ed cbgfd baecdg efbd cdgebf | ed baegfcd dfgcb dgbcf
+fgedba fageb cgeabf cabgf fgc fcae aebfdgc fc badgc decgbf | cfg abgfc cfbga fc
+abegd cdg gfbadce debgc cg cdfgeb ecfdba cdbgaf bcedf egcf | gfec egcdb fceg ecfg
+gefcb eacfg dcebgf ag fceda cgdfab cga gbea gbecfda fegcab | ga egba gdafbec cafeg
+efgdacb gfaed gfeba faegcd deabgc debafg ba fbceg dbfa agb | egfcb begfacd gab cfbaegd
+abgcfde dgebf decfb efg fabedc eg gebc cgfebd faegdc fdgab | bdefc cegb fbedg eg
+ebacdg dcbge cgab gc dfbgae adcfeg edbcf gcd beadg bfcdgea | acbgde gc gc ecbgd
+af acbegd fadc bfdge gedfa gebcaf aef baecfgd cegda cegdfa | dgeac cagbef cdgfeba dfegb
+cgdbef dcebf cdgeaf egcfabd bfge ebfcad fdgbc fg dfg adgcb | ecfdb fgeb fg gf
+decfb bc gfedc fcagbd bgec ecgdabf degfcb ebafd afcdeg bcd | aefbd fdceg dcb efgcbd