diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..2a6e744 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,11 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "day01" +version = "0.1.0" + +[[package]] +name = "template" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 4c1c501..01c1e46 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ members = [ "template", -# "day01", + "day01", # "day02", # "day03", # "day04", diff --git a/day01/Cargo.toml b/day01/Cargo.toml new file mode 100644 index 0000000..5a61072 --- /dev/null +++ b/day01/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "day01" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/day01/input.txt b/day01/input.txt new file mode 100644 index 0000000..80b734c --- /dev/null +++ b/day01/input.txt @@ -0,0 +1,1000 @@ +ninefourone1 +53sevenvvqm +kscpjfdxp895foureightckjjl1 +72fivebt9ndgq +28gtbkszmrtmnineoneightmx +four66jqrbtqcsxjtqjvfjhl1 +four8pzznjbhxlhtz6bhtzdxjlg1 +rgxjrsldrfmzq25szhbldzqhrhbjpkbjlsevenseven +slkjvk4threesevenznjqmmfive +61ppgrkmkfhteightone +1threesix67px +sxbjdbtlnjrmlzgxneightthreepmqxdxhfk8jfrheightwovp +twofour2sevenk +sevenonezknqnkfqbzffjvfivetwo94two +45xj +mp7one6eightvhfnmfive6 +fhtctftxm3threefour2b +2dq7bdmhhs92 +pdnbqlbvtcxgpnfhmsfhzstgm173 +8fourvxkddsrlcvseveneight +15zqpmsix77hlljgfive +jzjv6seven +eight1vbfive +721sixsdzbqtskbpkqbcmgmlpk5psrhr +pqxdxcx5 +twozsf2five +7twosixthree775 +7xtxrch7six +729twofourlqrxtwo +qtvbgtclhnk4ninefourseven5one +jvhngkcdjhnmqghdbqdzqssf5onegzjbbcchboneightn +five8two14five2nine1 +one3twomddthree +8nine9two +7fiveeight9ninesix6fivethree +254kcd61dc4two +7sixonetxvthntlngtwobzkbz23 +8sixnine6 +threedqtgmv2skmvcd +7ptdhpvr1 +lsvmzvzvd9mqxszjmbddkmxzdxsninedmglzlzphtwo +kgdt12seven4xxtttr5 +nrdtgdftjmfour6fxjninenineblqlthvpcx +ninezmstcdfchc11onebmmfdfhvdncrhc +1fiveseven +oneone26twoeight +threefivenine98one9twotbbcq +9cm7ninestc +jcrbmcjtrlzvz7 +nine8nine22 +3nineoneseveneight +58four2three +stwonefourthree9twonine4six5bvxgkxf +ninechzcz4seven +2tgzgmtzzpjdqqz +brsptjppb28qxcxxjbzpeighteight +eightthree3ninejrft4 +sixqsgkzdjmgpfive4threemxltqdxsfive +vxfd2q8 +khqhgqlxslkmbrvljcnineeight1gjgcqmnbdczqb8four +mvbltrgpfourcclxftbb7gcbqcptvgfsevenrdm +61eight +six8fourthree6fourseven6three +jqdfxvhjg3sflkn2sixptxxsqrfml +6jtxs +seven99threeone +five6sevensmbbrjqvdbmkbsqtwonelg +fdvfsndt32fourgllgfrninebhnzzczfive +9hxp9srhjhjjvqljhzprcjpqreightzs1 +djldhkkcn55threethreefourflnxnbzhkzmx +fourfive43chfvjnvjrkpxlgjrfnqbl +fxjgtj4 +1sevenfour2fiveeight +seven43rxxeightb1 +9sevensnxkp3lpzxfxnntkxzkrhk7jzhmtvn6 +25one +threeone7 +1pkfvsxxthreeoneseven +ztbvfqnpz2xdhgdjmgvfourtworqbxqsh47 +8four7sixninesix +threedgl88cczqhqxjnc +nineeightthree4sixfive3sixdqlmscqjk +16crjsdl +tgq2sixhc7three +tzgsqspndt5xnqlthghzfvkkhone +4fxdqrs64ninex34gd +seven22 +kghfkrpvnppfncbhhqpt55bjf +hjhb71bqdrrgsrkqdtsgrxgsscqjmtfzjkzsbp +lgdnt9threeeighteight97 +pvjhnk83sixncvgmsjltwotdmmpxknhvntfndxr +7449 +qdfzv9hkprplzkfh +66three5five4zdsfrcnljqmsxf2 +veightwo27bdbsvseveneightrcqcjxsixeight +1thvkkk +8bnxqfsdhzppblzlzbkfsksfscmb +zseventbdzlmhnnrfive1one +sixxnmntrmp6srcsqbrqnjfiveeightfive +4trnzlshnjtwo5twocxrvfssbj +6two3twonetqt +55qsnx43 +3three23tpctbkrnqv +sixqk4cnfdmtltmlhqxtwo41glkhdhgnt +35fivesevenpfournxzsbbgzthjvlvzrnine +tworkzgkcvcone53nrvgdvgtc +two9llkjbkz8pklrsgqqzr2four +ninecgpbgcnine4tldjqsone4six +2tfjhtfourfour +onebhlhdvvqx1sevenmsixsix9 +pjgjt6jkrgshxltfnine8four45 +4vsqfljrfiveqeightnvbdb +11nfslqvhm +7crrhqxsfive8ctkzbhqnine +vrvtglvthreettrkq5bdlrtpx718 +1btbxlthreedtrzgeightnineqczhqm3 +193 +fcbzxqxxjtmn47ffschdrbeight +twoh1gqkrnm1 +7ninesixpzpsn7 +5kkvzpgqd +three6nine +32fdn +22twoxgvktxpxmbjqtgtbckx +1hdtftwosix +2jfc +six5nvzcgmrscjn5eight4 +nineqhtczsninetwosix4five +9three6sj +hntktlbqmldrphqzxkhfour193 +twotwo5259 +v7six1vtlxnpm +rhsm2 +gprmtxbhlsv8onefournine +2fsrbtdvft15six1kxpqbnqsxh9 +one5onemxthree8 +nineqbxdbznzktxsmstsntzffour3one +9blhkhjsgsfgsblzdtqqfour8 +stz4889563cb +vjrbs6threeptbbmncz7hqhqgfgldtseven5 +vbfs1 +zjqgczjsjpvzvjseven4 +sixfjzbrrhcfqvglxhnsxninedrvtvjbfqjdbrzblkq6three +one3threegcdldjsrsssixonefiveonechngsl +7srxv4hsgjqsqfvv1tdngkpjrczkl4 +5scgdglnjbnsix8fivesixtjccvmkfxfnzvhctgpncjc +4eightfivefive1lgscbj7kpcr1 +eightknfssevenfive6jnpklczrpfeightwol +37qccxllhzshninebvpc8 +1eightmmcthkhf +seven8fourqn7tbgqnmzcc1 +sixsevenone4 +clhdvjnqnine9threesix +onetwoeight9 +81z3threenjsdhnqxvtwonezv +9hqtsb +onekgnlbthreeg3 +eightspnrpjb65fivevzfpvjntbg7drbgjccneight +ninerdlsix7285 +fournineninefive3vbnhmhdvjgdqcm +njzspqxpxrone7four55 +nfdhlqcpvzrrtsmzhgq3 +fourmfdtnpsfbxkjtgtgx5sixrppsqplqdjvnsixdtqvtdm +21onesix6sixnine2 +fffsmvtt8fivenineglrqrmktzzseven +fivefoursevencjxmskrqclz2 +lgk27threefourfsqrbkntbkfourvflgrzhh9 +617hj9 +ninegcxninetwohpfdxrb3tjjjtxtnvtwo +one1gnftc8onehtsxsmg +foneight3fsbhdqzr5twojbsdnntwohd9seven +zkzpfvcxqnbvrg1 +nine36cddqfvrf +rdjlpfk2pschfsdrpz +nine994three8six +three3nvflpftf2eight4 +3nine2 +rxxjdk5354 +hf4eight8qjtcfldnkvtwofivetwothree +7six3twodhnvmxj1nine +57seven3six6 +qklbvzfhclfnllhhgeight8xtvld +5fgzqhkssmkcfour1 +hhvjkdnlffnineeighttwo18twonecs +sevenbfzrgfm1six1 +nine71cskklxvcbnxtskdbqnpgklrxklcgccxjnssksrlkx +hmklhhjdthree77 +3vpxclbgkpone3ninesrclfive +djfqkgjvqpfvdsix5sixtwoeightsix +eightlt7csvgxpnslk +sevenfoureightnld2mxtgpbzpthree1 +11sevenglfmsb6 +onetjjnxvssg1four4drxbxpnpv24 +2zdxs9mfnbgfmjln1threefive +one186ltsbck +6fsbpb9sixhc +nine818 +xzqcpcdprsqjbgknkvztwo419q +39qfdlcnkhg31 +9djnlcrxqxhrcb8mczrxrm +nmb887525seven +jhmv3 +zhvdbn1fivem8seven4sixoneighttsn +6zmmjqmnftclqbcthree +6cpzeight92 +onepqfhtsevencvlfvnczhb91mmtdprqxmcnine1 +tvqdfxn8eight +five6fivercgrpbtjgv87jmcndclbk2six +jgtmrbvl68lpqkpxddqqxvsixfivesix +nine2nlffgkvmp +1frdnhssftg4eightgclxsgqtn +2sixblr94six +94mlfv +6vlqtcsmdd47hpfmlc7fiveeight2 +tklxghxv5bzc4hhcdcpmnine8 +four6one1zzgqghvs412 +xghjpblsfpg19ntpfmcfd +471rbdblzs +69fourhjxkvd7fourfour +jmrscfqdfppfdjskpk61 +five5eightnqpd9ninezknztwo +onelknchr7nrfprgmqzp +svxlxrx9892five2 +3ntkbzzpxhdmrsix8ttgp +ndh7zlnrzpvmnine +one7xlnbmjjmfv62qvqjpfprbvjkpcnine +99three5 +threetwotwo7dhtgtbchc7sixtwo +tmfxxph3eightgdccscdsrkmnhbb75 +joneight4one5 +nine3six +81tqzsqpkv99 +sixvjlq7 +five7bkc +five3811threelfpzztxzk +1fourkkpclqc3 +xgrpbmktcthree46g +bgcp4two8 +jtgeightwo7nine +bkmcrcq3eightrdtvrbglmxmmztqm +7tscmg5one2jhhbfb1 +zt5khcrgqjg5nxxzxzd +five85 +twothree1 +eightsixthreetwo6b3tnjmcqdjfive +onefrlg7 +fivescbjxbdnvslqqsone5bdbvskpmksqmmfsncsmd +two83fourthreefourseventhree +dglrmbtkfltwofive8ninelzmrxvxoneeight +8nine6sixsixtwo7 +sevennine4lbsevenkdnrhpltn +h3fiveeight4cplrnd +vhsgjbqm3ninedfhfsb +93nine7jvjmlzgcztrqlxtwo +zhhhdddbbgcssvfzdhmpone5fivefournine +l9fourvjfbqpdslkmvxsdrnsgcvzpjxm +kxlseven5two +rbtwonegsdgvsjtpnnkone7mdz +phffknvthree2threeqgvfqxgnine7 +2lgglnmthreeseven27three81 +lrgkrxx2 +seventwokxvzkvq6eightthree +5fiveseven +fstwonersngdlngx28nine +49oneninesix8four2q +hfvhzvmjgbfcbsevenrmhjhzkc3 +six84 +8eight2gzblldzvkjfive +6fz3eightzmsqb4qsbbsnthm +fcglpc2one51 +sevendqghclrpxt7pzone48two +three5one +5sevenfivebbzkjlcnxseven8fourmzqlxxgjvc +xgg8one6782 +gggtljnnsix3lkhdqzzpdtdkmjtgjddkpgx4five +qrmsfc13onevnhlbgs +nrtwonethreerbbqffzh62 +5eight81gcdbrx3rlk +mtdtxcmm2bgmqhgqrtxsn8 +onercx2 +9sixoneqgr4 +xmoneightfour2 +six85foursixninetwo +ninetwo8four8six +qchclfzq47 +khrll3two21 +seveneightnine8868four +3rmbmtbxjp12seven +3tsxgvqxmzvxbdvxtgrvdbzqbh +eight7fourjtxx +fmb4one7threekbxeightwoj +vcsevensixseven577 +2dkhlrrtrnbgzrmxm5fiveclhgn1eight +1sevenlmrbnfour17seven +three5jtbvkseightoneseven4df +fourrgqxplbpbxtsgkm7 +fourqdfxchlc371sc2 +fqxlmeighttwo1seven +zvvlftlhfthreesix6three46qkstxvdt +m74pjgccfour1four +plphq933eighteight +cdbqlhbhj3eight +4onevgdkxhz799five9fbljhpqmvk +two6qzgphxl +two1eight +onekxxghlonerqqlrs83threehvvdhsxmfour +npmsvvrdl2673 +fivejthseightsixtwo9vgrvjzbzsrxjv +eight2gqfive7mzjzpxqcvheightjfx +1bxckdpt +dngoneightbtdptfn85 +fourtwovfzgmxjseven935 +8onesix2drgjnlrxbtdlmlznine5 +five4mmpmqlttsx56ljdzldntdvthree +1nxxgtwothree22twothreenine +38eightsevennxctjfstp +8fourvhnps3onellstpnztn6kvjccmv +1bseven93eightfour +5nphkdbhxqb2pqxtkvhxq +nvvx6fourjgkdsczjv +fourxrmq78 +8tjmnvthree3ninetwo2five +p7cvtwoneq +7thbggjbznrsixonethreeninej +xdgm1crqfnklk +onehmqqgh4ninenthjonegfjmvtfgd +sevenbsqtlk9 +8seven9two9hdz29 +fbcjhzdgzdg8jgjvcrmgbcrsixnine +3bssqrj44onedqxvhkfive1 +tmmxtz5dtxbbcjlfivesix +pvfqzksgrs4khmlvtwoeightlsx +psbttsmnpninefour42fivegsixfive +sevenfiveqscr7dfxpninesix5 +xmsjddzfxftsjfq6four6eight6three +seven42 +eighteight1nineeight9 +8c +pmqljjjzvx5znxqnsfour8 +78zlpxnvsqpgmgmk +four7fsgttnrgnlslr +fourtwo3jg2 +qlz18three5lpxfjvnfppqjxh +4fiveonetthree4eight +7lzffxkxnzjrtr +three7nineone46ksnshqgdpt +8dntxkkkgdxggvhxh2onefour5gqzsqkm +tjsixonedbklrxxk2twonxdpjzb8 +mfglbrjrq93 +seven37xhsrxrvcgninexbmdrzxthreeonethree +fivegznvfztszqlhtrsslsmqq43212 +tdthjjjbkeighteightsevenpcbmpfq2 +five1eightq +three13three4vrsrrtp +cgztjgqgdths2 +dhxztfvlonetwokszrv8prdpm2 +dfkcklchjj8twonine52ppvndfcnf6 +three7ninenkxfourfive +93sixlqxctdhmvssixone +oneqbvfrvteightnineninefivethree9 +jskrtmvsrqnpvcgsmxbonecmlrjpdpc4three +crpcfour54xxgzz +9fivefhdpcqsd +fivenineclfctjninefbsh2 +fivexhrzbqpfxl8sixtwoeightllzplcpllk +zxgl5qneightsevenone +sixpdc17thxfive +1twolftpzbmnzvdlkvlsevenhdvgfrjhmthreethreeddkdvht +67twotwo71 +oneeightcgnhtdxpfnsevenoneeight13 +eightthreervd5tnj17 +ssrsmhxrsixeight3gbqggcvfqg29 +6fivecvcdxnxhxxtlzthree +fournrrsix595 +p2qchlvplzdvchkbdzzbnsix7ninefour +fourthreefourtzvlrnr9m94seven +4jxzkrfourvtjpsnrllkjcczmmqnsj4q1two +4627qlpscgpjcnine539 +two6nineeight +63five66fivethree1 +skndgzsbsntwoone1 +threerzgdxgtthree2three +953lsdgn59 +27bk +sixmfmbslpjjsixsvnqrvtxznffive5 +2ninenlgpggxm42six234 +fdzfvkjnchsevenfivethreetscllgjvrtqckfnmz3cszmt4 +7ninetlzsxjsl2nine3 +shsvptqngsevencjjthvfm9six5four +7lsrq36threevzfjc62 +two59threedxmfourjfschvqvnine +khfqjmksxhbvs8sevenhzrmjtkgm +nine2stgflmsm8fkthhhjzlszdnmkmqpnjxrfc4 +twofourthree244nine +eightvt978 +fivefiveninesixnine6513 +2lbtz19fourtshqsvblhrkhxbpfour +ptt7bntxhdvl +mskflsslvdlmndmmqmfourtczqlssnineseven5xxxkfvzd +l329eightsevenfourfivethree +rmlksxsixspp9fourhlcg +8five9q +hqoneightsix19nine6xmjbtgjzgrhmlrxq +six38 +9eight2 +3sixbzhgfcg57sixsixjtqmknd +9fchn58 +vrpftbnvonefour6 +vqgdtrvhnnxxsevenseven9eight +56vnine5rdpsnlqcbq7three +vncrjds2cmrg7 +213sixfivesix +tzclpzdsthree4sxgjvrzcrzcndnfour +4sixseven1three7 +8fbrggzmtqn8 +four79p +twonineqonemfour3dq +5fdgpmrghtksn5onesixtwo +xseightwongqqsxtwo8jslclldvnb +nine1one +9gxjrfourvhqzcxdhrtpxgtwonine +eighthfhtnvchtc7fjkrxsmhtm7rbk +thqxcfjbksix32xqrgqsqtx +6qjqql +jgcreight7eight +6onesix4threeseven +5vcv1twoeight7 +fivesthreebvjntwo9jdxghmxvl +632msc9threenineqfone +dqxfourkb4eight +6stsp3nine +566sevenpdmg +xprjdn55 +9mjtcmhjb +twoninelkjznqztbc3twolnhjhdbfxmhfr +twotczpxn6qlcfdlpnq +4ninefive +1rs44three2gzczjdgq7ssmtgjbgbb +ggmzqbkgsix4five23bftjlmbfbd +threehfcscmmlqvcjtpthree98 +7sixsixone4 +2fivefvrr9four4three +1zt1seven +9hsbthqvhhsnineone23tslqccg +sixbqvd3 +22148four3 +ninejlpbtnfive41rtzqjgfmcbncrrlnn +9sixfour +qnhfivetwofjtqtlxd7lmrlfctq864 +69dqrzhlqssgcsxtz54cpmjvrkcfiveseven +fiveqpv85frkmpgxgc +xxqsscldeightone9ngqtkf1nine +5sixgxbnnjsvhf5dgxgone7 +sixsevensqghlvkfxnfour7 +8gmgvjbfivesevennine +qj796fourone9 +rmpfsppvzdtwo4threetwotwo9 +dqvtrhm3nhtrxxccmfiveonedfzfvcghr +4threejxkhnxcxjoneightp +sevenhkpfgdgsgnvseven3m +qhrvjcnfdbqchrsvchcxfourbkhhq9six1eight +29pqnd +1oneonethree627 +5977rcr2threeeight1 +fournthpqbztrhnine64 +fjnjpgqxr86five4sixxhrtvbp2two +7sdnvlb5two +58vffgzcgx4nineoneeight3 +h1sjgqbhndbz1oneqgncmhnleightwos +gjms21 +onetwodphfznine51 +gxpl3fourzfz3 +five46 +mqsixccffmc9gqk1 +5kvxpqrrpeightthree +threefoursevenfive2dhtbrxlzzl +shhczssbltllsmntntlqfqgnnl98rm +5oneeight3vkqtwo29 +bv69fouronefourone6 +eight6five966 +4xnrtztgfgcmnmnsevensix +gmsvtnjd1sevennine4xxhqfbrjjqbglqjngttc +mdnxhhteightfive5onenineninegqjbqmfd +xonefourtwo4 +onesix61 +sjmnjhkj2892eightnine9 +nzseven39 +99nnjjzdrfsnjhthree1sevenfive +6xmggtbnblnbxdpkzblnvcvjqmhvntwoeightseven +76five6six +chdfjrlfhdzeight778 +xrvrck9five1hrvpfvkdcb7eightnine +foureighttq5sgdfourl2 +4rnbxrhhboneonefournine +5four3 +1b97eight +hlcjghlhsf32tgknm565knxqr +onecqgbgdcmlb2sixsix6nine +kxdkz3 +seven5xvhrxdm +xblqbgkqgsixvgrthreezxnzhknklxhbmgl4 +fvnkc7threethreeseven +bmbqxv24jhdg +97rfphlxvtx +4pgblonelone +ptdpllrddeight3 +9knpjzskrfd4 +twomjqdtbbvmj4shvsqrone3 +9zzh3pjsf6mhxlhm9glglfztjm +cfconeight47fivetdsmndgvsmbqjvszb +21vbqjz374 +sixeightqgfdjbhfd4oneeightone +tbccqdpz78srmcdx4six2 +643gqtvhkljxt +klfjf4qms +zrnhkhqzpczzfqsgsrtxklpbtp72 +1cnqfltrmhphg832three +twoseven5 +mxkmxlcgsixklclrkfr8638fourlrqpzgjq +nkbfkh452pthree +zvcktvd2485four88 +rfxj4 +three6jnr7 +two45rldjnmxkjphtwo7v +fivelncjffdnkzqrshvthreeh3p +ninejgrbmhrbqldeightnine6nine8one +96lvpt2djrkc5 +7seveneightthcxgthreeseven5hpfddktpj +6bvn +sixbjxtphstzgspnmkcvc952one +gmmslrndvltlthree394sevenoneightl +threenine7onefourtwojxhzvqlseveneight +5eightsix4txcczzmg +84seven +skjpkhxggsvjbprhllgjhninetwo6 +72bdpzccvone4zbdzlllnnonernlfvdpq +bvrtmzmtwonine29 +mrlvmdnlxb2814five5fjxzlhpn +lmrpf82rksix611 +tvq18oneqnmmzvtclnthree +jrbjc1zbbpqbrddt26seven1 +lxfivenmdtnhdmf98ptpxsgmgrxkmmznlk +zbmvchmxsevenddddthree2dxlddjp4 +three3onejg2fqgtjmpcgeighteight +three2two9seightfjqtwo +ninefive8sevenvnssix +3cnbxxtgmf5 +kpmjcsfrjfgzhmbpnqmlvrhbhqs8 +3vvcone64 +fvqksdsixthreexbfivetwo3 +sevenseven5 +63twoone8vhbcpmmlfive1 +4ctwo17eightsixkpvlgpj1 +rsgsnone1 +kbvxonemcqfive3eightone +ninenineone45threepvsmrtonejxmbnd +37fklnjkslqk9th9 +fiveoneq8rcgdxtwo8jfkxq6 +rgd7 +7rgkdpvp7qrb +7crtxfmslxxtcxsv +mqdnltb23fiveqcdqtonethree +8seven7 +8cqhqlhndqjznqhdbld2nspnxbj99tqqhp +onelqn7 +bvbjfour7 +ldqzhvhrbgsrrkh5j +kjsjxdcqgjztldjvxxgr9twoxfknxrrrphkdzdl8 +rvscnztblp56ljqtwompclcf +2dbtdgsevenhzctckvkvxvjljz +tvmhhxbbxvvsnlnineqsltjd92one +9twoqdmtvbxhpcthreeeight +81dvnkd87xbct +6mnxqnndcjfivefdckzmppfsevenmqvvvbnrgs +lvl3qjk5 +3fivefive +ktvsqzrf14eightmtnqbcktk5 +sevencdknznbxseventwo8rzggmvpbvlrs +hkhhrdxlml1xzbshninejzqc +eightseven23shkgzdgvvcxxfdv5 +14five1sevenxfmhtptwo3seven +47one +2three3 +f5dszzs2 +xmxffxkxpkninethree8x6seven +glzoneighteightrnjqgjznjm9 +63fznqxdfqt8 +33nine +4vrbmthreefbdzf +fourninethreesixnine9fourlvbgqhjbqncnlbjbz +two848dbvbninenine17 +pqzqgone1two +eight7lmxbhcsix +szr2fcvkljctlghhthree +sk81pxqhhhhvnjvgzfiveseven +cgqqkrz2vpdpzrthqssg7nineeight +498eightfournine +eight85onesvxnineone53 +ninevmchpkcg2 +six2shsvqfivefourtwo +mdzckfvr72cv +twotwo7onethreefourdjtgjg +tworfclmm3 +5sfvnkrmrptsix7four6kzlmclm +1onedkqgzbr89kphvc8 +5seventhree8eight9eight +kvjpgjgrcmpdscbfthreethree4mjqjnnzceightwohh +kjbmh1fdkdtznmsznvlconeznineseven +1fmgpxhxpqznqscvbszhhcmglvtnzhbbjjbzg +1mfqzkfnine5 +rrflkqslxztdlqxqkdnhqd7ps +39123thhsmscbpxr +8vnine4jgqrvqtshg3jhhdnbsrxneight4 +xkqgnfour87 +lsbnjqtzqz7ninenineone73lmkbnkhs +9fiveqqgqblfivehttxk +8twotwognd +4xknbheightfour6358 +4cqtpfjpf72eight3 +ninemjpqpqg8foureightsevenfcvpnrnnpzhcgkm +37twofivedsxrzbpchnkgxqx +oneone57one2k92 +mckoneight9threefour1onefourhdrcrvhqcmngkjnsthree +945 +tmmtwo7 +57 +6twoxzbfftnr27 +threenine4bqpztsixfour +84eight +3jpbnjrqhqfnxckqkqdvls +9gzzjzz +374nine +ninembxeight4sevent +threecq3 +cvn6cvqmpmfflkzphndjnggtktwosn +pgz7four5nineeightsixqrnfkdkgh +6one781vstwothreef +one617fourthreefourxqxnpv +8eightsqmkjkkf5xckcvd4lfnnfour +seven23qhntfmg56onexkjxh +f5s56rfltx282 +twosixninefive1tlzq +threetdhghclfsksql5oneninetwoseven +zbqzxmpb9pxlrthree +r4gxdzjnvzfonejnpmfcpgvxjjvkh8 +five338threejkk67seven +twolntxcnzvfr55sixtwofivesevennine +xhlppbqfr71brvppsixthreefddlgpfslqmdv +kxsklgonefjfpkd4threefive9six4 +6srphqmtdoneh3glthreefour8 +rjzdmj1cqvxnx1nvcvbfctft9 +3fqjdgbpggthreesix53 +9fivesndgmkvckblktzkshglqgdl4ztwoseven +qqrxkqhnzb23two34nine9 +8hrmffgstqpsixeightx1six +jngcsjnrhn2zsvcjmjg +9zfdmhzxdnfour272dcrqgk +lbjbrfhjxhxjphzxsjsix4 +fourthree2seven1two +twosix87 +vrlqqkctddggcvcjcpk6hxbqvbxmtsix +mrcgbpc6dthzqmmthreefour6two +r2zntjxgpfqfmqh +fourseven3 +6nfnsgchjdffttmgfnbvlxzoneseven8 +8sevenqqfiveseven5twojvgk +4rmtkvml4 +bprnine85 +sevenmfpcvlblcnine485fourseven4 +sevenseventhree68fivelhqgjqvcdqkvds +3fourxsgghqnvtssnvfs7nine7 +1fiveone5hpfdgvxb +eight2eight42twotwoonenine +lpdeightxcgpxkkeighthtjpsninemjlxrxtg31 +4smqpjzsixonethree +mr6csbmgrdrjj3onelqd4four1 +5sixvbscchd3 +384sps +4qzgsvmfx4ninevcclvcfrfp6tckcpvj5s +8l5glclltgcjgbhcg6 +3ldtdmjc6threeone +hsrtzl521nine5qqrtpdsp +z4v8threejdsmbfjpbj +9sixln26eightwovmh +848 +kndxtqpfrqxdxtfnqrqznpgvp9ninerlzcdvdtwo84 +kmqs84775seven +5threefourzkg +43five8cq2kprvdqrmxr1 +three4ttjqdh +48nine7sixfive +22x +sixrgtwo3rnbzkrztkdkg +4t +29bjpskmxneightppvthree +zmlzxvtlkt4seveneightbxseven +5two5eightnpszzmbkncnstx4 +9vk98sevenhznkxmlrlk7vdbqgvfjdk +1sixb8sjkvdhfld +one42eight4mrsdnpfjpvdtq +76fourntsrfllxkdfqvm6seven +skqndhr3nm4776 +4xpmfxmvj633eight +83ninecmpt +fourdthree9 +9eightjqnnmthcrseven +7threekgtf1 +xscj7threenmhsixseven5s3 +cqlzjt41 +855threemlmmqkgtfk +ninefzmvjjtvbmgf8nineninetwonegcn +ccpkzcldfourkdtfkjxvfb9fourhbtwonsoneightnl +pkeightwo5seven88rdnzzsdkbjeight9 +threen2fjsfivesix26nine +nine4rz8nine7bglpcmkqfzpseven +eight94six8dpgrv +twodfctf278 +fltqtmdkgjsvf72three +llrtzsixsix4fivetwosixone +qjhtjqjhgkjkzlpxxclsrdnzk1gbqt +sixeight1sixtwo +one5413nkmqjtlbdkz22 +bhtwoneonemzpzkqeighttwooneqkmcmsbq4 +sevensix3three2sixprcqcvm +25tjffdrtwohfqlkhzxlhb +97gcgqgjnpsthfjfdv636jsxq +zggjmjone1297six8drzs +jbpvnineeightntkkshbjvr3nshnqzdlkjmkfive +5four2gkkbxmpthreefour6 +5two15sixfivetzpg +one4fouronemfpvnqseven +9fnlbljdnzzfournine78 +djfljccrtvvqktzzvk61onesd +7twohbkeight +seven1eighttwothreet +4mdcljknhpqgxffqpj5 +nine9jlsmfgdgntwothreeeight4 +136nh +635ninejghg5 +cmone7fdlk9lfivemzvnhkcsp +8eightnlndm +6fourpb892 +fiveseventwosixfourthree7 +5fm +ninegchdnrf63431 +24sgnflnsixninenine8 +snm9 +3fntd721dhhkrqqxsfpstsvzpgonetkhcr +jlzfbml61vdmgb7one +266517 +7fivetwo2vhchmg678nine +cgrp3vzn5ninetwofour +666ninefour +9s +svpcnlktpxtvk42jhsvvdpftxpsk +2qznfzvbdr +foneb7eightfivehlbjjknninethree +kfp6 +l34pxxhxtd7d +rsbcrtwo27twocqlmeight +jkzgvqgpjfdqvmjfx2flnvjmgllxghhrbjjkfour2 +45sevengdnf59twofive +6fivespvkblrxvkcgdxktl +three9dvrssvl5eight4ftsix +seven56gdmlbfbjsl894sevencmc +814 +1one4 +onenine5fivekcrf1gvvfhlncsv +2ctvq9djzddfxcrj +ntdlcqgsixvmfvlc4fourvlhtvvqmnmkrm +9nineseven1seven +lcvzbnfourksvjqvmv47one5 +nine4blvlvlpkl6 +sixnqxrhnztzvpmbzmxjm19five +18jtzhk +rzrhv8four +2npghxvjonebchsprfhsjznrxvxnine +eightngsevencrjkxbhpgtxlzhgb46sevenqhqmlfx +threesffl9fivelgmndjfvseven92 +seven85 +87six9vnshclz +threetwo7915three +one2vkbp6rhqbxvcl7 +bsbr1five91 +qd3mnine +jjvhltxtdh5nineone6 +mbxlnj7bbhnxonejtmtqjfrzqgtrhkeightnine +fourfourqrxdtfive2smnqp +7tvjrszvrhdl5five +four15tvmpvxpvdjnine +sevenvv5tworpvdlseven3dlqvgblqtwo +nkckggninegnlqlnv25threexlhlbzvzk +3vngmhprjseventhreeeightnine +nvqtpzsszrdvttfivenine56oneseven8 +146 +fxfbone59 +f32dhffctkxp6rcngvtfq +sixthreefsixjhckmjqfive495 +42four +65nine984 +5fthreeone9twoqqsfvzmp +ttwonefive4 +one6gfxseightxqcq6 +3sixnrjtwormrncmhxeight +jhdxnmsgsdsevensqsslbsndpdmznmldbgeight3tcvjjv4 +5sixtvpckxzcjzbmrzk9 +pmdmnfgkb3six8xsmstsmxgmm +53onetvlgbglq4zbqpdgsskzdsksd6 +kzjcllvz6skphkfdxfiveqrbhmk +75qqjdgxlmfthreevzbfjdlxkfqqq +seveneightjntpjthzptwo2two +2five4fvrfxxnine4qzkkfkmq +2xlvcltn7 +fnmggtj2rqxzh7three +rzpjkgtml1 +2oneseven4one7xps6 +rljfhfrhmzkjxktnszbkpfspxdkqneight2 +pzgnine49six2 +plxsqeight2 +eight2sevenseveneight8rfcrsdlxb +sevenclpqqfxgjnmtwo9 +9sevenrqsixone8eightrxqgfsbjh +kqtkstrxhtfzbllhl4lqvqkcbr +hfplfpbltczflpp7nfive8 +ninenvqfrvtwo6onel +threev65 +frhn18six9sixninefourrsqzgd +mcxckfg5vpkbs89gbninexjzvlj +fivesixdx28 +7ppbqv +hs9twopcvpgtjnrsvksskpc8 +9mlpckzj2twothreefive +rkrgdclkninetwo6eighttwodc25 +tfivefourtwohkhhgsqlj1dtdcxmxkf +1four6five +fgbvmvxvtsix2twonine2sixfour +foureight66 +s6fourcv +mxl358sixfive8six8 +ztbtwo73sixvxsix9four +eight7qmdlcxfive5 +phgfivekrjxdmnzsqsix9 +1mfqsevenhz +rjhcdgzngtc155bqlttbsxklpknvlmk +qjkdqlrrs6two +sxlmqzxdpxdnj9fivetwo9seven5 +2qtdblb2 +8qgdzrsixtwo598oneightp +1shdb944 +vrlpronek2 +jm52 +8eightfourseven11mvtrmtkr2bmp +mnvnjxrgmrxhztwo2ssrdpqk +ztfive435three6threetwo +tnrrdnbgnbhzljdxhxxfrqkcpeight8js3 +foursix6zcsrztvgjxmp +five7fourgnnkspxcmczcbgsbdf77five +fgbrzkmvgrdbqjqndpfive81onetwomtzlfb +2qbsfd1two3ninetwo2 +8tdjxvfpvdvone33three +lpchnmln56twofive8tfour +cfkfbhppjf6fourdkfxsvdtbcjspzlseven8 +5fivestgkzsevenonedkhhrkthree +37nine8six8onefhvvbkmgdfgtv +26hzz +5glvnsztmnfjmkjseventdm4five +pvnnqrqvftrbcvnnthreenine5 +mgscxxlp3eight +53eighteight +two1oneqlcdkbddfour +jbll3 +8threeseven5tmtrgdhqxd +8twonine6s1 +91seven5pmqrjlhqrtzs +jj3sevensix4482 +jeightwo7lk4three +zchchxmsctzffivefournine9sqhqkgfour +72xct1 +vnsxvsqkhpfvgdseven23gzcmltzgone +xzjqhcvsix1fivecjtxnfivekmvjdc +zdfourgjlhtwo24d5klkpdgqbz +7sdzzdbrxbtonerjcmknnql4dfzqccvqt +tncqzxjq9twofiveqkxdrxrpj894six +dddmkctrzlpfmsszeight8zvbpmpkg +three23ckjhgjc +375jzdhnfcfr19mhsbnplqh +vpbbjlzone5sevenseven33four +onejzfsevenrbskjq1four +seven13one +vcnkfgv979one6zln +rqlxzzbmjb4lmbthreektqsdcfzbmdsfivethreenrxdlkqt +qkoneight8 +5rfourfivenine94fdprsix +onexonelzdh2lcbqpzq6 +six6v +7gtgxqnnine +tsljzhntwo3fourpbjncgmvf3fflvjxp +vfkdone9fivecftvmjdk +xc5three6eight94 +18363one7 +8fiveksshdlfmzhljhcmjrn7kpv5j +xbhmxfhbjnjzmninethree7 +2933mkmdqjcl +6ncvzqxfvgfive +lnine5fivetb4qmfktnqjxs +93187 +5mqninedzkfhbk +two7eightntdbsix298four +sixone3bspxqxggkmkrbcqrhfrxrlgjrlvfl96 +fourfivehqls3nine +threedfklszn2threeqzhh7one +mqmftzglone6kjpgglznhrjz89 +146cvkftscqsevensixnine +nndhdgpd484hxdgjtfsdxxg9 +6mbzckbjphg +eight6jbjtnld2mdjtd +zjtzcqxb736five +jlkdmone8 +gvjnjvmlfvcmvnfb8xcgjcmjqvz1bzcctvsixfzqjlhfkfk6 +vr6onejnjmrrldnsixsix5six +ninembtmtkgbctlfive45cjzzrmgcscfbcgeight +2mdvneightjzgffivefive4 +hmdnbxghxjxt4czshmsfzc +61six18threehrcj +six3five6eightkdfzhxcjkdhq3 +jrhqrqkpd4hsixdsbjdpscclmnnhknqq16 +jflzcxr3three +threefourghvgsktkc93cmjmsgh8one6 +96fivesevenslklhsfmpz +jgkpgfnnbq2pmspdfhsqxfour +g4fourthreerpkdhjhlxlzvnineseven +xkxhkphnkvpdnlncn86srxthree +7sixsevenrfour +5zr72qltsrbdsv +ninervqzdfzqmf6five +8jslpvs73 +ztvlxndlm5twohdhmtrdnhbzdrxb +seven6nine4dpdpvrtrmqvql +jfz1 +5nineeight5onefivecxtqbsdtbthreefour +fourgeight6threeszgseventwo9 +sixfour3 +npl8 +tzjkffsvbjseven5rhmlxonezlx +5dhtpfour +twothreebxtfndvdnine1sixbb9 +five9nineqlzrmtgs5 +9v764nineeight +five4eightlsix6 +3nineeight21 +foureight8btsc +3xgdgtb2 +7threetwonexqk +kkqsix48onefourhlsh8 +onekgtdzgfh2fivenine2onerb +six4zgcnlhmltrxp5xphvtwo9 +eight7cdqggpssix +niner9pzmrbqldkljmgphrrgmdjseven6 +439 +twofoursixrthree5bxppnhqtx +bmpnt3 +fivepkzkzpghrptpksevenseven83two1 +9fiveone8one +fiveseven3lqxghdlskbltrzrstwo +fournine3ninephlghonetwoeightbvmdcconeightq +three2pvklmzqjfh4sixonedrctlsfdfour +three91spjlscscjcxbbpdhrg37 +57qqjpdfppsix1qxrh5mlmncf +4nfone5eight +eightqsix7one +4jtvxfd38hnrmqkbnvfxpp +qmfsspkfour1plmslcrsseventhree +fzckcbfvxbpsix7nine +fzrj4 +4threeqntnineqstzjftnine +tkrh6sixdqflrvtmzmfiveseven9ktmtvprkxhfour +nine4983four +mpllmjrfgv66five3kvhthplrtwo7nkklb +9ngvdjddqbz +5twosix8lbhmzrg +eightsbmcfgm76two4hhc6 +seventwosevenrpm6threeeightwodxs +xkbseventwotwogmkxhpmhm42hvvbfchreight +gcqeightwosix8xdlhrnnbkmsevenqdbrjghz +458ninextfjxvgsq5fltdsk6 +rlgsflhxqd5bdbhclmrthree +twothreemqqbzjn88blvqxbseven +rqrrdrmlfsixfive6 +eight959tzxkgqjd +txdszrn5eight3cqeight1brqr +45122 +jvvslnkdk6qnfzjzvseight55eight +4twoeightgrhhkrvtkrzpfive7seven +three8gsmkpzsmfvf2 +fiveeight5sevenone9twoseven +4seightjjdkdglspz3vg +sevenssrzkspld2 +qnzcvcthrsgjlnzxmxlppjdpnine8seven7 +eight7xhvkrcr +two2tdjdfbqtqxrs119r \ No newline at end of file diff --git a/day01/src/main.rs b/day01/src/main.rs new file mode 100644 index 0000000..708646d --- /dev/null +++ b/day01/src/main.rs @@ -0,0 +1,87 @@ +use std::{fs, ops::Add}; + +fn main() { + const FILE_PATH: &str = "input.txt"; + println!( + "Welcome to AOC2023 day 1, first we will read the file {}", + FILE_PATH + ); + let contents = fs::read_to_string(FILE_PATH).expect("Should have been able to read the file"); + + println!("And we parse the file!"); + println!("First thing: {}", calculate(&parse(&contents))); + println!( + "Second thing: {}", + calculate(&parse(&text2digits(&contents))) + ); +} + +fn parse(input: &str) -> Vec { + input + .lines() + .map(|line| { + let digits = line.chars().filter(|c| c.is_digit(10)).collect::>(); + let len_digits = digits.len() - 1; + let number: String = digits[0].to_string().add(&digits[len_digits].to_string()); + number.parse().expect("NAN") + }) + .collect::>() +} + +const NUMTEXT: [(&str, &str); 12] = [ + ("four", "4"), + ("seven", "7"), + ("e", "ee"), + ("nine", "9"), + ("five", "5"), + ("t", "tt"), + ("three", "3"), + ("eight", "8"), + ("o", "oo"), + ("one", "1"), + ("two", "2"), + ("six", "6"), +]; +fn text2digits(input: &str) -> String { + input + .lines() + .map(|line| { + let mut line: String = line.to_string(); + for (name, num) in NUMTEXT { + line = line.replacen(name, num, 99999); + } + line.add("\n") + }) + .collect() +} + +fn calculate(numbers: &Vec) -> i32 { + numbers.iter().sum() +} + +#[cfg(test)] +mod test { + const INPUT1: &str = r#"1abc2 +pqr3stu8vwx +a1b2c3d4e5f +treb7uchet"#; + + const INPUT2: &str = r#"two1nine +eightwothree +abcone2threexyz +xtwone3four +4nineeightseven2 +zoneight234 +7pqrstsixteen"#; + use super::*; + #[test] + fn test1() { + let tst = parse(INPUT1); + assert_eq!(calculate(&tst), 142); + } + #[test] + fn test2() { + let tst = parse(&text2digits(INPUT2)); + assert_eq!(calculate(&tst), 281); + } +}