From 44376bf893fe0e0e4db9c34af3cf396e69655818 Mon Sep 17 00:00:00 2001 From: Jan <26145882+imverum@users.noreply.github.com> Date: Wed, 2 Dec 2020 17:29:13 +0100 Subject: [PATCH] day 2 --- day_2/input.txt | 1000 +++++++++++++++++++++++++++++++++++++++++++++++ day_2/task_1.js | 31 ++ day_2/task_2.js | 26 ++ 3 files changed, 1057 insertions(+) create mode 100644 day_2/input.txt create mode 100644 day_2/task_1.js create mode 100644 day_2/task_2.js diff --git a/day_2/input.txt b/day_2/input.txt new file mode 100644 index 0000000..b5f851b --- /dev/null +++ b/day_2/input.txt @@ -0,0 +1,1000 @@ +8-11 l: qllllqllklhlvtl +1-3 m: wmmmmmttm +2-4 p: pgppp +11-12 n: nnndnnnnnnnn +17-19 q: qprqdcgrqrqmmhtqqvr +16-17 k: nphkpzqswcltkkbkk +6-9 c: rvcvlcjcbhxs +18-20 v: hbjhmrtwzfqfvhzjjvcv +5-9 z: jzzhzttttnz +7-13 d: bdqdtddddnwdd +9-11 d: ddddddddxdldddd +6-10 f: fblhfdztgf +2-11 b: vszxfnwghcb +15-18 n: nbnmwxnnlkmlknnnhn +2-9 z: lhwqvczrrqqhqlfvkbcm +15-16 d: dndddddddjdddddbdld +7-8 k: kkkmkkkf +1-8 p: rdcmrkbwqjpph +2-6 s: cswdpsjgsfvzkvqqmrqf +9-11 m: mmmmmmmzbmmmv +8-9 j: jjjjjjjjfj +7-8 d: dddsjnds +1-4 f: qffb +3-8 f: cphmtfff +1-13 s: rjsscssstsvssss +9-14 s: gtsnlbqnckhxmssbbs +12-14 j: jfjnjbjrjpdndj +15-16 t: tttttttttttttttwt +7-8 r: rgrdrrrrrrrrjhrrrrrr +5-8 t: lpcqfgzttlt +1-12 r: wrrrrrrjrrrrrrrr +14-19 d: ddvcdddddddhddprldl +4-8 d: pkddlzxsl +7-11 x: xhxqxcfkxwxxnm +3-7 q: qqqqqqjqqqd +3-13 s: rtzsktsdfhtbs +8-15 n: nnnnnnnnknnnnnsnnn +10-13 r: rrrrrrrrrrrrnr +1-9 r: ldfdgzprnptrd +2-3 k: rqkthj +4-7 p: prrpswdpnmpxmjzsp +12-13 p: pmwbptnpppjprfpkppgj +4-6 w: cfwdlw +2-9 r: pnnvrfjhz +14-16 b: bbbbbbbbbbbbbtbbb +2-7 l: xlmzgklxljcl +1-6 c: cccccccc +11-12 w: dmpzfzpwwnwwpggw +2-3 c: xrccccmcc +12-13 k: kkkkkkkvkkkvkknkkk +10-12 h: hhnhcvhhhqhh +17-18 d: dddjddbdzdddvddddw +1-5 p: pppphp +11-13 v: fvvvvjlvbvrvdhbvv +10-14 b: bzxxqcgqnbkmhm +1-14 g: xggghgngqnggggggggg +9-10 s: xslsmpfnxvvssqmgf +16-17 s: nfqggjzbfsssllwns +9-10 w: wwwwwwwwfw +13-15 z: zzzjzzzjzzzzzzgz +7-10 n: jfnwgwnnnn +4-5 b: btbqb +1-5 w: vwflw +15-16 v: vvxvdvvvvzvxmhxvv +3-4 b: cgbbqk +1-3 f: bffffdfclfffgfkf +6-11 m: xckgmdcqmwk +6-9 c: vcptncxbcg +5-6 m: mmmmdm +2-3 d: dmdd +5-7 v: vvhrxkd +7-10 b: bbbbbbqbbbbb +8-9 m: mhvmmwlgm +3-4 x: xvtxkz +3-9 w: wwlwwwwwkqww +4-18 g: mxslljzcgpwsrggqqc +2-3 x: xcff +16-17 j: jjjjjjjjjjfqjfjwhjjj +9-13 p: ppppppppgppppp +16-17 f: fffffffffffffffffff +3-5 c: cncpcck +9-11 c: kzcwczccccmcfsrcc +3-7 s: ssdsssvnsssssjs +1-6 v: vvvvqv +5-7 b: fzbbxbbbgbb +3-9 t: gtttttttftt +5-19 p: ngpnpklwsclptfjvtgm +3-4 d: dddtdddddd +4-5 m: mjmmwl +11-13 l: lllblllllvllrl +2-6 h: cphqvz +17-19 w: gwwrvfglsljwfgxwbbw +15-17 x: gfcxzcwgjmkwfqxrxzrd +13-14 w: lrmhhxwfkwnkwnbsq +7-8 f: ffffffgcff +11-19 v: vvvvvvvvvvzvvvvvvvlv +7-8 k: kxkkkkpk +7-14 v: vfvvvskttcvvvvvfvv +11-12 m: mmmdhmmgmkgmjmr +1-7 p: hpppppppppbnc +3-8 n: rttbbpjnmzn +8-9 n: nrfnnvxrp +3-4 x: tnxnngq +9-12 s: mbhsxshssrtwvm +11-15 n: nwmnlhgjnnptkmn +1-4 x: xmxl +1-6 f: bffffffffff +2-4 r: zrrr +2-3 t: ttmwvt +3-5 n: ngnnr +13-17 p: jtpppfgklkpshpndpp +1-7 r: rrrrrrrrrrrr +7-10 h: hmhhhhhhhzhhhhhhh +9-15 l: glxqscckgxtkzfllk +2-3 s: gfsh +5-6 b: dpphbj +6-13 h: hhhhhhhhhhhbshgh +5-13 d: dddpbddddddddddd +10-11 p: pppppppppdppppp +5-7 j: jjjjjcx +8-9 r: rrrrmrrrm +1-3 f: ffff +8-15 b: bbbbbbbgbbbbbbrb +3-6 h: hhrhhhhhhh +9-10 v: tkwvvvjvvvblvxvxhxvv +5-9 t: ttttttttmtf +1-4 m: fmmmmm +5-9 n: nfnlnkblnnfnxtzn +3-11 v: dnsvvvbvnvvxvj +8-13 h: nfgmbfjhdhlhb +2-14 q: cxtgcrpsxnjshlqbh +5-13 b: bbbbjbbbbbbbbbbbbbb +4-5 l: wldljllcl +19-20 b: jbvbbbbbqqbbbbbbbbbs +5-14 b: bbbbbbbbbbbbbbbbb +2-5 q: qmqjqhfk +12-13 s: sssfsnsssssssxsms +3-17 z: zzzzzzzzzzzzzzzznzz +13-14 t: ttztttstttbttb +2-6 q: vqhhrqlgvckvsrpwmqwz +15-16 d: dddddddddddddddhd +5-6 w: wwwwdwww +1-2 f: jffkf +6-10 j: jjjjjrjwjbjxgpjjjm +4-5 c: cvgccmcqzrcd +3-7 h: mghkhfgzmkz +10-17 f: ffffsfffffffpffwkff +4-9 g: ggbgcgjgggggg +8-11 d: mdnddhpddddm +6-7 c: ctcldgc +13-14 m: mmmmmmmmmmmmlmm +18-19 t: ttttttttptttttnttgt +7-8 g: qngggtghnxggs +3-12 c: scccrbjtdccq +2-3 q: qgqjq +5-6 x: xxxxzxxxxx +6-10 v: nwjsxvzhvgmsglftbpvc +2-5 m: xjtbsffdwmxmhxrmpm +4-7 c: mfgcvqccg +1-7 c: cctcccc +3-4 m: cnnw +10-13 s: sstssssszsssss +9-10 h: hchhhhjhdh +2-4 j: xjjgsz +4-11 b: rbblbbpmbmbdbjgcbhk +10-11 r: rrrrrrrrrjrrr +3-6 g: hvgfzgjrkdf +1-10 b: tbbbbbbpbbbbbb +12-13 n: nhnnnnnnnnjnznnrnrxl +7-13 w: wwmwfncfwdxww +3-4 c: wccq +7-16 x: xxxxxxtxxxxxxxxxx +3-7 k: zmhkssxs +1-8 n: gnnnnnnnnn +13-14 r: rrrrrrrrrrrrmr +2-3 r: rrlr +3-4 c: sccccwvpjpplgctg +1-2 b: svbs +1-2 f: fbfffrff +6-14 l: lllllvlllllxtllqllll +13-14 f: ffffffffkfffjf +1-6 z: zzzrzfzzzzm +4-8 k: kzzktkgrzjdkq +6-8 j: jjjfsgjjbt +3-7 q: qtqqqqq +17-18 x: djxqkrlcwxxxlvhjxh +6-8 c: tqpcgcjc +2-13 f: khqhkkszblvffhfwcg +7-18 p: kjxrtcpptzpxddbkts +5-12 l: llldllllllntm +2-7 q: bvvrnhqhpqw +2-6 s: scssswssss +1-2 n: njdnnnn +4-8 h: hhhzhhhhhhhhhhhhhhh +9-10 j: jjjjjjjjkjjxqjjw +4-9 t: tzdqtlttttktttttcttt +4-5 w: wdwht +8-9 x: xfxxxxfrsxp +3-4 m: mmmmgwwbmztpmbmmmtls +8-17 f: mgzhfgfffswbgnvbc +5-6 t: tttttg +4-18 x: xxxwxxxxxxxbxxxnxxx +2-4 l: cqglmhmtjls +2-4 z: zfgzr +11-18 k: nrdngbjkpckjxwdbrh +8-9 f: fffffffpf +4-7 g: ggtgghgsnggr +5-6 w: wswwlw +3-5 b: dfbbjbccx +2-3 t: tdwfzg +4-5 r: rhrbw +4-5 j: jjjjtjjn +3-4 k: hkzkk +1-2 c: cdzccc +3-5 r: vhlrrvhr +4-9 l: qbjdqldwzdl +6-11 f: flvpvfcfrgg +17-18 g: xgggggghgggglggggz +5-6 v: bhvgvl +7-15 n: nnnnnnnnnnnnnngnnnnn +6-15 d: dtddsddfddmcpdf +10-12 b: bbbbbbbbvlbbbbbbb +2-12 d: szdghlzwxpnd +3-4 z: zzzw +6-15 t: mrnjvfhtlqwlfzt +8-10 x: lcxcbrxxjw +6-13 r: rgszrlzmmlpdngchhxz +1-14 g: fgggggggggggggggggg +3-5 n: znnnjpksqtzt +17-18 l: bcfmqlsltppxwsxslb +5-8 t: tttnctttt +4-5 m: mmmmnmml +15-20 k: kmkpvxkgnckknzkpkqkt +12-15 x: xxxxvxlxxkdxxxx +1-5 v: vjdndsvsjvqzvnv +1-4 k: kkkkkkk +5-8 c: cxccccccc +2-4 v: vdvd +12-14 w: wwwwwwwwwwqwwbww +2-3 b: kbbtbrllwp +14-15 f: ffffffffffffffm +9-10 v: nlngldlnvsbwcvvt +4-5 c: kccxccc +5-9 m: bmmmmmmmzmf +8-9 f: fzfvffjffffv +3-14 r: rrqrrrrrrrrrrjrh +13-14 p: ppptpppppptpqdpm +6-12 t: tttjtvtgcwvttttqkt +5-10 z: glsrzctzzz +5-8 s: gckwcshsl +17-19 n: nnnnhnnnnnnnntwnnnd +7-9 r: rrrrfdrrxrrrrrrrrrrq +17-20 m: rmxbmmvwphmxmzlmbmxm +14-15 l: kkjwtlsrlhltmdl +14-17 f: ffffffffffffffffff +3-13 l: khxtqtwbvpmgll +2-4 w: wwbmww +9-15 n: nwxcnxnckttrkdqnn +3-4 t: fgnwjbtlntsr +15-16 x: mcxxxxxxrxxxpczx +6-16 w: vtcvkmrwvlmwdvrwmqj +1-3 c: mmcjckwn +1-10 c: ccccccccckccccc +14-16 l: kqjhpjgzvxlnxxll +4-7 r: xrtrrrrrcrrmrrrr +8-13 m: mmmmmmmmmmmmcmm +7-8 r: trkrrrrwf +3-4 n: pnjn +1-5 k: skkknkk +11-16 k: kfkkkjkqpqgkzkkkkwsn +13-17 f: gdllffxlxwncljgwf +3-5 s: gwspdtjtnlbsfffvhlg +15-17 m: krmfcsqbmmmjwgkdmm +13-14 l: knhdrdzcmdhlll +2-3 p: frps +2-9 z: lzwnzmvnqgkpbxv +5-9 n: nnngrnnbj +3-5 c: mncnbk +2-5 n: djgnnnnnzbnnnx +7-8 v: vvgvgvvm +5-15 w: wwwwwwwwwwwwwwwwwww +6-7 d: dddddcz +7-9 g: glrgcggvgckrgggz +2-3 n: dnwbnc +6-8 t: lttztzqt +1-4 m: mmmxm +4-14 l: qqhgtftklcnmllcbgbrx +2-3 d: sdnk +12-15 l: lqllljfglvldcql +2-10 k: kgkkkkkkkkxkkkkkkkkk +10-17 h: ljpwchmhhzmhdhmrchp +6-10 w: lpcfgkslrwwrlkhx +3-7 w: wrpwcpw +8-9 z: kczxltgzh +6-11 n: nnnnnhnsnlnnn +2-9 s: smssssssgss +2-4 x: xxwhxbfjj +1-2 z: fzzzzzzzzzzzzzz +4-5 p: pplcdpp +3-4 c: gncxlzc +16-17 x: fxqltszfgnnkxgrxhcbk +13-17 n: nnnnnnnnnnnnnnnnvn +1-6 x: dxxxxxx +7-8 r: scbnvqrpcbgmpmrrs +2-17 d: ddddddddddddddddhd +13-19 v: fvtphwfnmpfpbpjnnbv +7-18 q: cpwqnhqjqfkqqncbsh +6-10 c: cccdcxccncfxcgc +2-4 g: fggsgbgggggcggt +13-17 r: hspwrxrzbrvlmlwgrkxr +14-15 l: pllgllllllllrmv +12-15 g: hqgcgggsxgjxljgdz +3-4 d: dtxd +7-12 d: kddvbkkdldqbkn +3-13 v: vvvvvvvvvvvvtv +8-13 t: tttttttttfttdt +18-19 q: hprbdznbqlfnwzwpqckb +5-12 c: wwlqcgzqzvtczvcldg +3-5 z: xzzzv +2-11 c: xbblzgtwcjcfqqb +8-9 n: nnnvbnmvl +8-9 z: zzzszzzzt +2-3 l: chsrlrl +2-4 f: nffm +6-7 h: hhhhhhhh +10-16 x: xxxxxxxxxxxxxxxwxxxx +2-19 v: ztpvktjgjlmqfrrxfpv +2-5 g: gncgg +1-3 t: hjtttttvgtttttttttt +3-4 s: nbvs +5-10 n: nnnqnnnnbvnnn +7-15 q: qqqqpqqqqqqqqqzqqsqq +3-5 b: sjtwbr +2-4 t: sttxln +1-5 d: ddddd +12-13 v: zvdpfbkkvcpvdvb +3-6 j: cnnjhj +7-8 q: qqrqpbfqjvbtqlqjqkqh +2-4 v: wvvq +2-7 m: mpmrmmmmdnmmmmk +10-14 g: ggmcgggpggcngglm +3-5 g: fsbpglh +4-5 r: rdrtq +3-4 t: qttltttl +16-18 s: sssszpssbnsssssfss +6-9 b: lbxbwbbqn +2-3 m: dmwsg +4-12 p: lmppwmsplppx +3-15 c: lvjmlzwctxnckvclsj +13-14 t: tttttttftstttw +1-5 m: jmmmm +2-3 r: rsfr +1-4 d: xdns +2-3 k: qklrwnskqnx +1-2 r: rrrr +5-8 l: vlsbftlltc +3-12 n: nhjlchbwphmn +6-7 h: thhghhv +1-11 v: vvvvvvsvvvk +9-11 c: ckdqzdkbjczkkcpdj +7-12 b: bbbbbjbbbbbfzbbb +3-6 v: vvwxkv +6-8 t: twttttttt +12-17 g: gfggggggggggggggg +2-3 g: gqgggggggggggggg +8-9 h: fmjhhbjhvv +4-7 q: qqqqqqjsq +4-5 p: hpkjp +2-10 h: bhsgwpwnhh +15-18 p: nwpqxrcxgjxbbxczxb +2-3 k: mtkszk +9-11 c: zccccpccrrc +5-6 c: qnzjgh +7-11 t: ttttttmtttct +1-5 p: pppppprplmpq +3-4 x: sxlc +12-14 q: xsqzxsrrmxvdxq +1-3 k: kklkjkvkkkkkk +11-12 k: ffflkkkkkkqkkks +2-3 z: zlzzz +10-13 k: kkxkkbkkfkckn +11-15 p: wkppvppxqxpnpbpkpppp +2-11 r: krqxlrvhwhlj +3-4 l: llllllrrbll +12-14 n: nthpvpzmwnsnnn +15-18 w: jwsnzwwwwwvwfdwggcw +15-16 k: gtxkxjvtkktkkhkr +1-3 m: kmzmmm +9-10 j: jjjjjjjjvwj +5-8 p: sppkrxzpbppppphpwv +5-7 w: wwwwgwhwwhppmqw +5-6 h: hchhhplrhphqq +4-5 g: bggbg +3-4 h: sbhmtvhhrbd +1-4 l: lqfl +5-7 j: jjjpjljjjj +3-5 q: qqqqdqqqjqqqqqqqqqqq +1-13 k: kkkkkkkkxkkknkk +12-14 z: jzzzzzzzzzzzzvz +1-4 q: bqqq +8-9 w: wkwftfmfx +7-9 s: kssjlslpmqssx +1-2 n: dxzmtsvnfhjnqsfln +15-17 q: bqmqnrcjsmgghgqjr +8-11 z: zzzzzzzdzzfz +6-7 z: znznzzz +8-11 l: jvlntmjwwrrqlkzrhg +1-5 r: rrvrjtrrjzr +4-20 d: fbvprndxpfqplmtkntdd +7-9 l: llllllqlclllll +3-6 n: xrnjzmlbnjwwzdzmdj +17-19 d: ddddddddddddddddxddd +9-10 w: wwwwwckbwhww +2-5 h: gchshhhn +1-4 l: gtlq +15-16 z: zzzzlzzzzzzzzzzhzdzz +5-6 l: lllfllld +14-16 j: jjjjgjjjjjjjjjjjc +6-8 d: dddddrddd +4-5 h: zhshc +8-9 g: gmgxgbfqg +1-8 r: lrrrrrrzrrgrrrrr +4-13 c: mccqccdccccwccccccc +3-4 z: zhzz +10-11 c: crmmvznptct +2-4 l: slblllt +1-6 q: wqqdqqtqqqgdqqq +2-13 l: nlllpwllpjdbxvbp +6-8 l: mxsflqrlhkqhsrmhtwxq +4-9 t: tpwbtdttt +2-7 q: fzqdrbg +7-8 d: ddpldttdddsd +14-17 b: bbbbbbbbbbbbbmbbbb +4-11 x: wfrxkjtpxlcbgc +6-7 n: nnnnnjn +13-16 z: zmqczdggpqzpcrlz +1-8 j: jjjjjjzdmjjtjj +5-6 v: vjsnvmb +5-7 q: nzqqwbqmbjwllj +2-3 j: mtjg +12-15 d: ddxdddddddddddcddd +4-15 g: hssvxrqgngtkcmh +1-4 m: mmmmmmm +11-13 j: jqjjjjjjjjmjj +3-4 z: zznzz +2-6 c: cccmcs +6-10 x: xxxxxgxxlxxpxxxx +1-2 b: bbrbbbbb +2-5 f: xfmkcf +4-5 r: rrrkxr +3-4 z: zslz +3-4 w: kwwh +15-17 x: rfxxcxwxsxsdgnxlxz +17-18 w: rwqlwwgwwwwjwbcjtw +2-4 p: ppjrpp +16-17 b: bbbbbbbbbbbbbbbtb +5-6 b: fbwbqt +3-5 b: bbjvxg +4-5 j: jbhljfjz +4-5 k: fmkkckpj +18-19 w: wpqtwhngztqkvgqrcjf +5-6 t: wttthhtt +12-15 v: kvgvvvcfglsvnsp +12-14 n: nnnnnnnnnnnknnn +5-8 k: xxzhdkmmkkkbwv +8-9 f: fdffdgvwpfffff +12-14 k: kdbsqwkjhvbxrkh +4-7 f: fvhkstfdrwfkvv +7-17 x: cvkbcvbfxxgxhbxxxpbx +11-14 m: jjnmmmsvhzcmcm +3-9 w: qwxsnsxnwzsnmk +1-5 k: tkkkkkkkkkkkk +5-7 h: hhhhhhdh +3-13 c: cclccccccccwccccc +1-4 w: wwwnw +3-7 z: wzzblltdglmfkl +9-12 k: kkkwqjnqskkdhckhvkk +2-5 r: xjtrrsxrrdzlbjvflqxr +9-13 g: gggbzggggjgxkgg +1-8 m: zmmmmmmhmmmmmhmmmmm +16-18 h: hzhhhhhhhhhhhhhhhh +2-7 w: wwwwwwvw +3-4 d: ddhd +3-5 x: jxvzx +15-18 k: kkkkhkckkkkkkkkkkkxk +11-12 m: mmmmmmmmsmwkm +7-8 k: khfkkktj +2-7 f: ffffffff +2-6 q: hqqdhbfvc +3-5 f: rlpffgf +3-4 t: wtltht +4-5 f: fscfx +2-16 t: nmtppmqttqztvdstc +1-15 j: jwgcbkdjlmjjxzwvpvd +10-12 v: vvhvfvvqvvvv +5-6 l: llllbwlll +1-2 z: xmszvzrwpm +6-11 d: dddjndddddq +4-9 r: xwkfwcztcq +9-10 k: ckskkkktkr +2-4 x: txpxfq +1-3 j: sjzj +7-11 x: bbhcswxtnhx +9-10 q: jlqnqmhjqhqq +4-19 d: qddkdmptbvjpbrjdzddl +7-9 d: sqdpdhhdx +7-8 j: gjzmzjgd +10-15 s: gkgsssssssqssssrpc +5-6 v: vvvvhbvh +1-3 c: cccc +1-3 c: ccwcccczgccpccz +2-4 t: tgtmqtl +11-13 w: wwwcwwwwwwlhw +4-5 z: nzgzrz +4-11 s: lhzxmwclxss +15-18 s: hmszwkscbdzsrgssjj +4-5 m: wkvgzjmhxmwlmlmvsjv +11-12 t: lndqtmsfwpjp +2-10 w: wkwwwwwwwww +10-11 t: ttgpwkjltgn +3-9 b: bbvbbbbbtb +5-7 h: rqlbntrhhkjhhhrdhq +1-2 n: rnnrbnn +8-11 n: nnnnnnnpnnnnnn +4-5 s: vhsnsjc +5-7 b: tbbbbbcbb +1-3 q: frbq +3-4 s: xsssmfsgs +13-17 k: kkkkkbfkkkkkvkkkkkkk +1-13 v: zvvvvvvvvvvvvv +11-14 c: cbcmcccccccmccc +15-17 r: skkrrvsrlmrrrrrjdrrr +1-7 m: jmmqmmmmkmmmrkmmr +9-14 f: kstfsxflhffxsffkb +7-9 g: ggggggggvggggg +13-16 t: tttttttgtttttttvtt +9-10 p: ppppppppphp +3-4 w: wwxw +9-13 g: ggggggggrgggvg +3-4 f: ffkffq +8-11 h: hbhhzhhhhhfh +2-4 d: dcnss +6-7 r: rtrrrbr +5-6 r: rrrrxq +1-11 g: fgggggggmkglk +14-15 h: vlqkqhhhfwhxfvs +3-4 w: wlrsgfsw +1-2 v: dxkwzvvxv +2-4 r: rvrcrtrrl +4-6 t: ttktttt +10-15 j: jjjjbtjjtjnjjjk +5-6 s: ssssssss +5-7 s: sfnkzss +4-5 b: shbtb +2-5 j: hjktjm +1-5 h: hhhhdhhhhh +5-17 m: mmmmgmmmmmmmmmmmmrmn +2-6 b: cxgxbbskzgdhr +10-12 k: kkkkkkkkkbkkkkknkmks +13-16 g: ggggggqggggghggggggg +1-2 w: wwwl +6-9 b: bkbbmbbbzb +6-7 m: qrfhmmndrkmc +5-11 p: ggzmjkxpnrpf +2-3 r: rhrr +6-7 f: vppvpwf +8-10 w: wrwwwdvwwjwwww +6-11 c: wxrbztwpcccj +14-17 x: xxxxxxxxxxxxxrxxxxxx +5-8 c: cccccczqccc +2-6 j: jgqjjfjzjjjjjjmjjj +4-7 t: zphkzttgtjdxdtd +4-7 t: wsrtdqgthqjvznbj +15-19 h: hmhhhhzhhhchhmhhhtxh +1-3 z: zzzz +2-3 j: jcvl +1-7 w: wcpwswwgjfb +3-6 c: crsvmcckc +9-10 f: fffffffffjff +3-6 v: hfvpwvgg +2-5 r: dkhrrd +1-5 f: cflmflfdvbz +3-13 k: sfkgcgktfkhrh +3-9 v: mmrprsvzv +3-4 q: qqqbcrkq +11-13 r: rrrwrrrrrrrgrr +6-11 j: tjjjzpsjrjdj +14-18 t: dtbhmtltcwpnzwqtgt +2-5 c: rsccchcc +11-14 m: kmmmmmlvmmtmmm +7-10 x: xhxxxxxbxbhxxxx +10-13 n: nnntnnnnnpnnn +3-10 w: wwwjwgwwwgwmww +17-18 p: phpppnpqppjsrpppzj +8-12 r: rsrbwrrrrrrzr +9-15 q: bqlrdqqxrdqqnxq +5-11 d: sldcndtlpzdb +1-3 w: zwww +11-12 k: tkbkwkkvsblpt +13-14 c: ccccccccccccqc +1-5 c: ccccrc +4-5 f: fffnf +3-4 w: wwwvw +2-4 k: kzkk +16-18 j: jjjjjjjjjjjjjjvqjj +2-8 v: wvqlrnrtgbzrp +6-10 c: cccccdcccccc +1-4 q: bqqqq +5-6 n: nnnnnnn +2-16 f: cjrffhfpfflxljjfp +3-8 g: ggfggggggg +7-8 z: zmzkzzzczwzzzz +7-8 m: mmmmmmmmmm +7-9 f: vzlffftfw +4-10 w: kckwgbmtws +4-5 g: ggghgp +6-17 w: wwwwwwwwwwwwwwwwkw +3-16 f: fffbfffffffffffcff +9-14 l: lllllllwmllmblllhlml +1-4 s: sssdssss +3-4 m: lmnm +10-11 v: vvvvkvsvvvmvhv +3-4 p: pprb +3-4 k: pkqk +3-4 d: ddxd +7-8 b: bbbbbbfb +5-7 w: qbmhsmt +11-12 b: bbbbbbbbbbbgb +3-5 x: xpxbljxt +2-9 z: kzmpqtbvzrqzh +3-16 v: qwvfvltjrpdxmvqv +2-6 n: pdjxzkn +7-8 j: jmzvjkjk +2-5 r: rrfjqqft +2-5 h: pwhfh +6-7 m: mmgvjmm +11-12 r: rrrrrrrrrrxqrr +1-4 n: nnnw +1-5 z: szzzzzdtzz +7-13 j: jjjjjjnjjjjjbj +10-15 w: rwwwwtmwswwwwwwwnmbk +11-13 t: twxhrldqtttmnt +1-2 r: bkbbrwr +11-17 h: hhdhhhhhhshqpbhhn +4-7 c: crgchccbnr +9-11 r: bdhgrzkmrrl +6-8 g: gggggggzz +3-9 g: ggggggggqg +9-11 z: zrfcqtrxxqzcx +3-9 s: zstjqhnvgjjfxknt +12-13 p: pppppwpgcppjppppptp +6-7 k: kkwrkckb +8-9 k: kkkkqzjkn +8-9 l: lrxlkbflrl +1-3 n: nndn +8-9 d: ddhddddddd +4-12 g: zdclfqvdgnzfv +3-5 d: ddddkddddddd +9-11 x: xxxxxxxxqxxx +4-7 t: ttttfftt +2-4 n: wfmnnddqxfm +16-19 r: zhjsgxjkjpqmpvkrjgr +3-7 v: vvfvvvvv +1-2 d: qdwdfj +6-10 h: hhhhhhhhhrhh +4-16 x: xxxpxxxxxxxxxxxxx +18-19 q: qqqqqqqqqqqqqlqqqqf +6-10 g: gkcntgbgbggklsx +8-9 n: nnnnxnnnpnn +7-9 m: msmmmtdvm +2-15 d: twjdrfzntqhnwkd +1-4 z: kzzz +16-18 b: tbbbtbjbtbtflzckhb +4-12 k: kkbhkgkrkgfk +8-10 q: lrqrjqvwmrb +1-3 f: vfhf +7-14 v: vvvvvvrtvvvvvvvv +4-5 n: xnntnwntrfnbqqdk +3-5 r: rhkrzwrhrrr +2-4 b: bspbjb +5-6 s: sfscsc +6-7 x: xxxxxhx +8-10 w: wwwwbzlmqw +7-10 v: fkvdvjbfvd +2-5 q: qtqspqqq +8-9 k: kmhkkhpsk +5-8 h: xhdhjfph +3-6 b: dlbkbb +1-3 w: wwbswwww +2-4 x: mxtx +2-4 l: llrll +3-7 j: kclqzgc +2-3 r: rxrrrgrrrrr +2-4 q: nzwxlmcqqqm +15-16 h: hhhhvmhbhdtbblbh +13-19 l: ltkftclmlllflzltlnb +4-5 p: zmwtpjrltqdmfppz +6-10 t: tjdxqtsbzhvprspljmv +14-17 q: qcqqqqqcqghqqqqqjq +1-5 j: flxrjspwlrdqsnjcs +14-15 m: mmmlmmmmmmmmmwm +3-5 d: dddvkwksdcrktlpd +8-11 l: llcllllxllml +2-4 v: vvvbv +1-3 g: llggz +3-5 q: znqqmt +15-17 f: ffffffffffffffjfff +17-18 q: zwnkmcqdqlqgkwfmqc +8-11 f: fffsrffbfffffvfxf +1-7 b: bbbbbbbb +3-4 l: llzh +8-9 n: nhnnnnqknnbnncncnnl +9-11 v: wvvvvvvbhjc +15-16 q: qcjqvfdcsqwdrqqt +9-10 j: jcckdzkzjjb +1-2 s: hssmsssms +1-3 w: xwww +2-4 l: lllll +2-4 q: qnmq +16-18 t: tttttttgtftttttttt +5-6 t: kttttj +16-17 t: twlqttttttttttmct +8-15 x: xxwpxsqkxgkxgxxbdgx +17-18 h: hhhhhhhhhhblhhhhrq +12-17 m: fmkmmmmqkmmdrbvthm +2-4 b: fbcb +1-14 t: tttttttttttttqtt +17-18 v: vvvvvvvvvvvvvvvvvnv +7-10 x: vxxtxlxxlk +3-5 n: nnmnqnnb +2-8 s: vssjqsssssb +9-11 l: wlllllllllllll +4-14 r: zrlcrxrrrzrrrrr +3-14 n: wrnjpnkndsshqk +12-16 p: ppppzpppppphppppp +9-12 r: rrrrrcbrrfprrrrr +2-3 b: bbrb +14-16 d: tzdjdndddgsddlnddgd +16-18 c: cccccccccccccccwcc +5-6 v: rvvqvt +11-17 s: ssssssssssssssssps +8-9 v: vpvxqvvdvnvhgnvvlvs +7-8 d: ddddqlrt +7-13 d: bfzrkddtdwqld +4-6 c: cccccq +6-8 d: hkdndlqq +11-13 l: ngmllbdklvlmqlz +8-17 m: mmmmfmmmmmmmmmmmlmm +12-15 b: bbsbbcblbsnbzbbfcfzz +12-13 k: gbwkkkkkkkksk +12-14 x: xxxxwxxxxxxdxxxxxxx +3-4 m: mwsmp +5-6 k: kkkkzk +4-5 h: pqslhh +7-13 l: gmpxpvwqrnlfp +3-6 t: sttxtmtn +11-13 r: rrbmbrwrrrrrkhrr +14-16 s: ssssssssssssstsss +7-10 v: vvvvvvhvdvvvkv +5-6 z: sxpzzx +2-4 d: rmxd +16-17 z: zzzzzzzzzzzzzzzzzz +1-3 k: kjkkkkcckkzk +1-11 k: xzkkkkzkppk +8-9 f: bfvfdffzb +4-14 r: rfzcrrlmxqlrrrqr +7-19 t: gtnxjqtnjbkrwpzshqqn +2-5 j: kjjgpddjpjjjffzjjp +2-3 f: cfffh +1-2 x: xxxxx +3-13 j: jjjjjjjjjjjjzfjjj +7-8 m: sgmmpmjmwmmmtfs +4-12 z: zfzqzzszvtml +6-9 b: jsfbpkzwb +13-16 x: zsxxjxxsxxqxpxxx +8-12 b: rlzdlplbgbdgd +3-14 h: hmrhhhhhhhhhrthhhh +15-19 g: mgggggcgggggqgghggg +2-9 p: ppppptppzcf +6-7 b: bbbbbbbbb +4-20 q: skqqvxptdswwnrflkvxq +4-5 t: lqttq +1-10 l: lqkqllvllj +11-15 m: qmmmmmrmqmmmsmf +6-15 s: ssssstssssssssss +2-4 x: xtxxx +9-11 q: qqqqqqqqhqgqq +1-4 n: gpnnfnn +1-3 l: lltl +11-15 k: kkfkkfkmmkrkkkk +11-12 f: fkcvfvtqfcfffffffffj +1-4 c: ccjc +14-15 n: bvbvfvzcbfnzqlsvh +4-5 x: xxlmxx +3-6 n: nnrnnnwlnncnn +6-9 j: jjjjjjjjq +7-10 d: pdplmxdczddbd +12-13 c: ccccbctccccccccc +12-13 j: jfjdjjjjjjjjjj +6-7 h: mrnphwh +2-9 n: njnnnnnnnnnnnn +3-6 g: rgxgggggnjghgggntg +9-12 b: bbbbbbbbbbbcbb +3-5 p: ppppvpp +16-20 t: ctkgpgzrwwngltvxcqct +4-5 s: sssdsh +12-14 v: vvvvvsvvvvvvvsv +8-13 w: zwwwwwwvwwrwgv +12-17 r: wrcrrrrrrrbrwrrrxr +12-13 x: xxxxxxxxxjsvrnxx +7-9 n: nqnnqnvnn +14-19 n: nnnnnnnnnnnnnnnnnnnn +4-5 c: vscjrl +1-3 l: llrl +11-12 w: wwwwwwwwwwzww +6-7 t: wlcktht +2-10 r: rrrrrrrrrwrrrmrr +2-6 x: lhqvpx +10-16 h: kqrhxclktcqhxchg +6-10 m: mmsmkmmjmlmhfmmnmm +5-7 h: hchhhhph +5-7 z: vtzzzwl +3-12 z: zzfzzzzzzzzzz +7-9 z: zzzzzzszzzzzzzzjz +8-9 g: ggggggggg +13-16 f: ptvzfmfkxfdkfhjff +1-10 w: cvhnfgnwpw +5-8 d: fvvmdlfqgjc +6-9 s: rzlrwzngshvt +2-4 v: vgql +1-3 r: rrmrr +5-7 j: jkjgwjj +4-7 b: bbbzdzbbcbbb +4-10 k: kkkkrkckkgkkk +10-12 m: mmmmmmddmjmn +4-10 k: mskmvkcpqkk +5-10 m: wbtdmxnvrmwqbqkwmtq +7-14 z: cfzftzzqnxffzh +12-13 z: zzzzkzzzzdzzz +4-5 l: lllslllvl +5-8 k: kkkkkkkkkk +10-11 l: llllllllllwl +3-5 v: hvzpxfvmvcv +8-10 t: tbtnrtbqzwtkqtf +6-10 j: njjjpjjjjkjsj +8-16 f: cvpxnsxfdnpdfswdhbb +6-12 n: nnndnnnnnnnz +2-3 d: dzdd +1-4 s: jshkscssssssssssssss +5-7 k: kkkqckwkcl +3-4 f: ffdf +9-11 c: cpccccncccqccc +1-8 x: gxxxxgxx +5-15 p: ppvkmmpcvzmmczpz +12-13 p: xppppppppvpnpppp +7-12 n: nwnnnnhcbnjnc +1-4 f: fnzjf +2-5 s: tltqss +3-10 r: rrqkrzvkrtbqcrp +3-14 h: hhhhthhhlrwhhhthp +2-4 b: bkbhbq +15-16 v: vvvvvvvvvvvvvvvsvvv +1-17 h: vtjjhtxrchshpxhsh +4-7 n: jnpnpnn +3-4 h: jvhz +4-5 w: wcpzw +9-10 q: tvxbsfmqqblhq +3-5 s: jssstxfbsssshssgkss +3-9 r: fnrhqkrmtstqjgc +12-15 n: xqwnnnnnnnnmnnn +13-15 q: qqqqqqqqqqqqqqtq +3-4 d: dcdl +4-12 d: vrldnmpndmlgdzrv +2-4 h: mhhh +3-4 f: fcvfc +1-2 w: whwwwz +7-8 m: mpmlmmmmhdbh +2-4 q: qxbqqdsjrdpxf +6-14 r: wbmlhrcgrgrkzqfj +2-7 c: ghcvcdcmcztckct +2-9 n: nnnnnnnnpnnn +3-5 f: zlgffv +1-6 m: ntmmmm +2-4 w: jgqwv +5-12 f: gscfzhmrtxfw +5-7 r: rwzklcrnrrg +8-10 h: hhhzhhhpxhhh +9-11 x: xxxxxxxxfxbx +7-8 q: qdnqnzbq +2-10 s: sssmssslbb +8-9 n: wgfnghnlnkf +4-10 d: dddsdddlds +1-5 k: bfkkkn +2-5 w: wwwwww +14-16 s: bjszbzmcnsvplsrh +8-9 b: bbjbbbbbbvvbbx +2-10 m: dmnrsmtqkf +7-12 f: fbtwftvffsgfwlnw +9-10 h: shhhpshfxhbrdhshh +4-9 t: tgpdtwrmt +2-6 t: vhtwntl +3-5 j: ljjjd +2-3 w: hxwvbxwwbwsvc +7-8 r: rrrzrrnr +3-4 x: jxjh +7-12 w: mjmbtgntdwjwnqztv +5-6 l: vlvllt +7-8 n: nnnnnnpnnnn +3-10 c: wcgcxzcdwmcn +16-18 h: hchhhhhhhhhhhhhcmh +5-11 f: fflffffffflfff +3-13 z: zzzzzzzzzzzzpzz +6-9 k: kkkkkskkkk +6-15 c: ccccccccbccccctccc +9-18 p: klcpzpdwzvpqppspfpp +10-13 b: pbbbbmbbdbwtmd +10-11 v: xvvvvvvvvnnvv +2-4 m: msmmm +1-4 w: rwwlwrwrwwrfngc +8-9 r: rjjlddjrnbr +13-16 d: pzdfzqbwclbjddxtvddf +14-15 q: qqqqqqqqqqqqqbq +12-14 k: kkkjgrkkqkkkkl +3-4 d: gsdnkdfnf +8-17 h: glhfvrshlrqwdrfrh +2-12 l: mflqfvxfgzkmd +5-8 f: ckllfnfbflqgrsd +1-17 m: kckvffhnlmjvdtgpm +16-17 p: pplppppcppppppppppp +5-8 h: hhjbmplh +7-10 s: jsjlwgsssbsvfsvk +2-8 x: xpfxbqxxqxhdrxhqm +12-16 n: nnnnnznnnnnnnnnmnvn +6-12 v: vvvvvvvvvvvgv +8-9 j: pjjjjmjnj +16-17 h: hhhbhjhrhhhhxhhgt +3-11 d: ldpmvddhdrdjdj +6-7 n: nnnnnnnn +5-8 f: tglffvhgnfxzfhf +13-18 r: rrrrrrrrrrbrhrrrrrrr +19-20 n: nnnnnnnnnnnnnnnnnnnj +7-8 w: tpmmxqsw +5-7 c: ccccccr +9-10 l: qltnnlnfllqlw +6-7 g: xggbggz +7-10 s: sssssfcssss +5-7 j: jsjkxwqhjcvjtwjzl +10-14 t: qdtttzttcvtttnn +12-13 b: bbbbbbrbbbbqb +1-15 d: dshhrjkwcjjhlthdts +7-12 p: hrxkphmqpvpptpqbw +13-14 d: ddndddxdtdrkvldd +3-4 h: htht +7-8 c: xtsvzccfckccx +4-5 r: gstrwshptzrdtjj +7-8 b: wbbnbbbm +15-17 c: cgpqxbccqcjpzlcctmx +2-7 k: kvtqqmsx +8-11 s: ssxssssqsssssssss +3-9 d: ddddddddld +13-16 p: pppppppppppppppwpj +6-8 v: sxkghpckvb +17-18 s: ssssssssbsssssssksss +1-2 w: wlwxdsw +8-9 q: qqqqqqqqnq +9-16 f: fjdsfvkfqffffjcfpff +12-13 h: bhhhhhhfwhphhhhhh +7-8 k: kkkkkknkkkkkkk +4-7 w: wwwfpsw +8-11 d: rsndldddddxddmf +2-10 c: cjcdcccccc +6-7 v: zvnrhth +3-8 z: zzxzzzzzdzjzzzzz +11-12 t: tctdttttwtrtttttjth +8-9 c: ccccccccrccc +17-18 p: pppppppppppppppppvp +3-8 l: svlmlkspljr +1-2 n: nwnkq +1-11 j: jjjjjjjjjjjj +18-19 g: ggggggggggggggggggr +10-11 j: jjjjjcdjgjv +3-7 p: ptttppppppj +2-5 d: cdndsd +6-10 s: sssssmssssss +15-16 k: vxwxxhhkkhklqksd +3-4 x: rpxn +1-6 g: vmgckg +3-4 j: jjbs +5-10 d: qrnmbddndvcmdsjjbdhd +7-9 v: vvmgvvvpvm +1-7 z: zzzzzzwzzzz +4-7 n: nnnnnnqn +8-9 k: kwkknknkrkgkbklmpb +1-5 z: zzmzfzz +6-10 m: mmmmmfmmmm +9-11 s: sssssstsssgss +2-6 n: nnfnpgnnnmnnn +15-17 w: wwwwrswthgwhkwwrw +5-9 h: lbhdhplmbnwh +5-6 d: jdddqqt \ No newline at end of file diff --git a/day_2/task_1.js b/day_2/task_1.js new file mode 100644 index 0000000..7cc5298 --- /dev/null +++ b/day_2/task_1.js @@ -0,0 +1,31 @@ +const fs = require('fs'); +const file = fs.readFileSync('./input.txt').toString('utf-8'); +const arr = file.split('\n'); + +let invalid = [] + +arr.forEach(item => { + // Split the puzzle input + let split = item.split(": "); + let pw = split[1]; + + split = split[0].split(" "); + let wantedLetter = split[1]; + + split = split[0].split("-"); + let [lowerNum, upperNum] = split; + + // Check if the password is valid + let count = 0; + for (let letter of pw) { + if (letter == wantedLetter) count++; + } + + if (count < lowerNum || count > upperNum) { + invalid.push(pw); + } +}); + +console.log(`Total: ${arr.length}`); +console.log(`Invalid: ${invalid.length}`); +console.log(`Valid: ${arr.length - invalid.length}`); \ No newline at end of file diff --git a/day_2/task_2.js b/day_2/task_2.js new file mode 100644 index 0000000..c0bc688 --- /dev/null +++ b/day_2/task_2.js @@ -0,0 +1,26 @@ +const fs = require('fs'); +const file = fs.readFileSync('./input.txt').toString('utf-8'); +const arr = file.split('\n'); + +let invalid = [] + +arr.forEach(item => { + // Split the puzzle input + let split = item.split(": "); + let pw = split[1]; + + split = split[0].split(" "); + let wantedLetter = split[1]; + + split = split[0].split("-"); + let [firstPos, secondPos] = split; + + // Check if the password is valid + if (!(pw.charAt(Number(firstPos) - 1) == wantedLetter ^ pw.charAt(Number(secondPos) - 1) == wantedLetter)) { + invalid.push(pw); + } +}); + +console.log(`Total: ${arr.length}`); +console.log(`Invalid: ${invalid.length}`); +console.log(`Valid: ${arr.length - invalid.length}`); \ No newline at end of file