summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--input/day09.txt1
-rw-r--r--src/bin/day09.rs87
2 files changed, 88 insertions, 0 deletions
diff --git a/input/day09.txt b/input/day09.txt
new file mode 100644
index 0000000..b3f3292
--- /dev/null
+++ b/input/day09.txt
@@ -0,0 +1 @@
+(6x6)AFPLBX(2x3)ZE(53x13)(4x7)ZGQO(2x4)NJ(1x8)M(24x11)(18x7)HMLOASMJNGZHMCEVEX(11x2)(6x6)TRDPQX(157x12)(60x12)(2x3)SB(7x1)FBSAUFK(4x1)NMZK(10x2)RLIIHFEKRY(10x6)GMDUIQDOZJ(71x8)(1x11)N(19x5)EHNAZSRTFYXOZNFTOOQ(6x4)XKARLK(13x1)IRATYZQMJXHAH(4x8)VFUJ(8x6)AOOEHHBF(27x6)(11x9)(5x15)KTTHB(5x6)AELEZ(17x10)AOGNMNTGDJDYEMMEH(7x8)BOIOHRF(6x2)ZKXONV(172x8)(6x5)(1x8)V(17x6)WEVFHKUDETBOZVKIO(2x14)ZI(75x9)(5x5)EXKDZ(4x4)BOGK(10x5)SXYSSOACJR(3x15)FHO(24x10)YBZPMZIPUCEIYNGYAUPVFOKB(43x3)(13x2)MERJWKSXBIEKP(2x4)CR(4x5)DFDQ(2x15)ZM(89x5)(43x6)(16x8)RIGCVPPOSBRJSJCB(2x9)XI(1x11)M(2x8)QT(8x6)(3x8)XVC(20x15)SBWQFWQWPQHXZXDWSXIR(4393x15)(25x5)TEAACSAHWYWPYJZEPDIHUMIPB(1026x1)(1x7)K(768x7)(388x3)(113x9)(70x11)(12x10)HDEPKSMDLHAX(2x5)RU(29x13)BIOENKVYNENIFNCSWNZIJGCZXBUVF(3x1)JRO(30x2)(11x9)NCTAXULXPBY(1x5)K(2x7)WQ(76x10)(13x7)UDCLRUKNLOAEL(17x10)(11x8)TLRICJOXJPO(26x13)HBPYKHNJRGJHSXUFGJAAHODUDG(177x13)(58x14)(17x15)MWIVHZEKJKLDWPYEN(7x5)MLNEAX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MLAWWDVVCY(166x3)(8x4)ROOZHNPS(1x5)G(140x3)(5x11)NNJCA(122x8)(12x10)ACNODOEIPNFS(36x7)(2x3)HI(9x12)WVTUTLVXH(1x14)L(1x11)R(28x13)TFKQTKVMFXBNHUCUGXXBKSPBSYOI(2x8)RL(13x5)(8x5)BMGHNIWS(80x2)(4x5)CLIN(64x13)(12x7)PUIYXOSOYXRH(23x9)(1x14)J(1x10)L(3x12)BRJ(11x3)(5x12)LIYCT(446x9)(1x14)A(128x1)(86x9)(15x1)XKXMQLFUXTGSIUI(36x8)UUZAZBICEWZOHBKMLKFMOPRGDNIIXYZIRYBO(16x10)(3x1)DCZ(2x10)RG(15x1)TVCSLSBSQOEZORE(9x12)(4x5)FOWX(67x7)(27x3)(20x11)QHEAAUEGZRHVTYXMHWGD(27x14)(1x6)C(14x15)EHUGFRTEFCLPYB(223x13)(192x1)(27x13)(8x1)ECDZKCJY(8x12)HNTSWDYP(14x1)SMPGAHCDMTHRPF(43x6)(2x9)QY(3x1)NGD(7x11)QBFWGLX(3x4)JCI(1x10)L(31x2)(3x10)NIH(16x2)SFTKKDPDSTPUVOQA(46x3)(1x11)N(19x13)RGTNKUTACWUHOBKHPAF(2x9)JH(1x5)D(18x5)ELEQYVKHCZWCPDKGET(4430x14)(6x6)SGLJXG(1303x14)(8x3)PBGTOJDF(472x9)(1x14)U(299x2)(71x12)(2x14)UZ(13x11)(7x13)OYMYFOR(22x12)MLXGMMRGPSASXFVDRWWYGU(9x5)(3x14)NFY(96x1)(22x8)XALEFGLORBLTMHIWSARRDS(24x12)(17x14)QARJVLVCJVIJEJOLE(8x13)(3x8)HPO(16x14)UMCNXKMHFCKLLSTQ(96x11)(3x8)IYF(82x5)(3x1)OBQ(30x14)UJYENTNVNGKUFYSGTPROKDUVXVAAAP(18x14)OFJNLBOUNGILMQMTBO(7x2)UJJJZAX(3x2)JTL(2x10)YM(112x1)(83x7)(50x6)(4x11)TSPK(2x2)AU(6x15)XSSYWL(3x12)DCS(6x13)OIDFMJ(1x14)N(13x12)EEZZPERSDPKOT(17x7)SBEJBRDQAVFLLCNUW(3x11)ZGN(25x3)(18x15)CSVBGEAPPCXHRXBYIK(1x4)M(664x4)(337x14)(99x5)(12x11)QQXQUTFBUNIV(7x7)ALTZFYQ(15x4)VBFROTJMHRPGBJW(40x12)(23x8)UTBYEFQMPFIEXVVLZXVDWWJ(6x2)BMJTZF(4x3)NRUY(6x12)TKXPAM(62x6)(3x15)RQS(1x5)K(41x8)(12x9)NJRYDQRLHCNB(17x7)AEPPXIYSGQCVSPVMF(135x14)(72x7)(2x9)FB(4x10)OGAV(26x6)QXHCWFQUDQKXVJJGIZDZLTBIKY(3x10)CXD(9x5)IDBZUGYPE(14x2)KYYCJLAYHWQQVD(30x13)(7x11)YXUUJZQ(11x3)YRHZXTLPZJF(311x14)(49x6)(42x12)BLCUHNHXNFKMUKOHBMVPXMURVUESFYMANQKXIQEVOG(79x1)(73x8)(5x3)JGNSI(20x11)DVUPOLXLRCUFVJYHXWJV(15x2)OPIKHDJPHQPXYYX(9x10)FWYSCUOMU(164x1)(91x13)(6x13)UPDAGP(14x5)LIKFHUVDMDQAAK(31x13)FEJFKXKSSAJYNJAKXKRQPUZMHNTBTGI(7x7)OLHMUKA(4x7)EGNE(59x12)(4x7)JSRJ(4x7)JCES(15x6)QTFXSXGYBARIWUP(8x6)LQDBINXU(1x12)H(127x1)(12x5)RHGPFMZRPSFB(4x11)URMZ(93x2)(87x7)(75x9)(11x14)NXGIGQVUUMV(1x6)N(38x3)IUHTFEASJJFMMTHJFEQAAYMSIUUGNMTUUQSOCN(2x7)CN(1x8)B(894x11)(876x12)(587x11)(2x10)BQ(178x12)(96x3)(14x14)BLIWCROJXSLVTK(8x15)KIYKJSRQ(54x15)KTAQJDJHFWAVGGYOZUWYLIBCBQIXHICNALPOGMROGJLDFEAYDTVTNR(2x6)NS(11x1)JKXMXJTBIDP(29x4)(7x13)EBVJEZD(10x3)XRDYMAZSBY(10x10)OIRMTHQL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14)WPC(1x6)L(15x13)VAVFETWJRRFZFPE(11x13)VKJLGKAOCUC(92x12)(20x10)MRTDKUJPLGPXMTVLRSUF(2x6)QZ(11x15)MHFLVOFUNDC(25x11)SONLCWNGCZFGMSXYJXSFPVGVY(3x2)QRI(136x15)(45x13)(6x4)QQSQCM(1x9)U(7x4)VIDEIXN(10x3)WFRKVWNLJM(50x7)(13x4)OYFDFFFLITCIR(16x6)CIRLRKXBHVHNUPFZ(3x15)GRD(11x3)FMDUOABWGPB(5x15)EWSOH(3x4)JYH(338x8)(331x5)(324x1)(194x3)(2x4)ZF(48x12)(3x9)JVP(4x2)BWLT(24x15)KPNIHTTPTNNAHSSSDLAKDDNT(6x3)SZJQKG(64x15)(19x14)RSMBLFUAZBGBCJPQDES(5x11)KLUTW(1x9)J(5x13)UYNTL(5x8)NVICZ(43x11)(20x6)HURCGFJBVQOKDECLQELO(3x4)XID(4x9)WOCX(38x5)(2x8)KV(25x2)(18x13)SEYOWGYPRRKBHNVVGI(72x14)(18x10)RXBCYLJENTUPCKCIDO(22x8)(5x5)ZPUYC(7x9)LXRWCDN(2x3)XD(7x4)DEKJLWL(1794x8)(1786x4)(297x10)(289x14)(162x10)(78x9)(1x9)T(28x11)WCIFRVQWPNOEEBPKGYPFCOTNMRAP(12x7)IYTEKBFTEZIX(4x6)ALRX(5x2)QSCXQ(72x4)(25x8)OHCTVXZIEWNMEZBVFKTLIMGQW(4x13)XEBD(6x13)UZZITD(12x13)QPGHTTJTMMFJ(103x9)(24x4)FOJJCXKNPHEGIRYIFBLDVUES(66x14)(15x14)AJEUHOVVHZVHGAV(5x9)CVIBX(15x8)WIHEKYSJZCLABUK(8x5)UYQLGBEY(3x14)QAR(690x4)(14x3)KRIBLTDDRJSFGY(4x9)MMCG(338x15)(15x4)(4x3)VIER(1x7)J(76x14)(8x6)VNTBZCVR(47x6)(24x3)HDWQXSRQWIFPKUSRADRBXAPD(11x8)GSSDBTQZINR(5x3)TWHSS(74x2)(5x3)DMUEM(4x2)FLBE(48x14)(10x8)YLSBTQPTJJ(2x10)ZP(8x7)JFXOKRXJ(5x11)WDHLN(82x2)(7x12)IEXUOMG(8x11)PVPIWSQY(36x7)NXNEYNWWPODZRJBIQFLDLZVSEDRPRWZUUXQS(7x11)WWTZGJK(59x11)(52x11)(17x14)QMXUKMPFATJEJQASH(22x6)WEXAZYBXEIIIWKEYRNINYH(246x5)(7x14)XMWZOQI(225x13)(9x6)(4x4)RMSV(35x9)(12x15)FSEJCGTVXEUT(1x7)L(5x5)IALLO(83x2)(5x5)HEUVE(26x8)BGAOGWCKQJVESARPQNTDIKKOKN(34x12)DGCKPWQBLZNXDLLYIWKRAOVPCXIIEWLSMN(75x6)(6x6)RHDULO(16x11)CRXVYYDZXJFFSPOR(5x14)OXTUY(24x4)UHCHXFDOONZXAZTTBFSINOEG(55x14)(12x12)ZKOOCWQTVQUS(19x10)WNHJGQATSCBTMLIVOYB(5x1)ZHQEA(710x7)(2x14)FD(170x9)(162x11)(11x10)MJTMRWMKRNT(28x10)(21x14)MJZQATVTRTWDEQNSZOXKK(59x15)(1x10)K(16x6)AVTYFAJYHSKETUYI(1x15)M(4x15)CDYM(7x15)TGWTHWL(29x11)HWMXLXCZVSSUPDBTIXDEGPNJJZNGX(2x6)KM(487x11)(3x14)UIF(84x4)(5x14)MDENR(66x12)(12x11)WQEVOLYPOSEK(30x5)LKBXTFFEOHNEJHOHKMMUKSDISVVQZE(5x10)PFZCP(197x12)(24x15)JLPYUIJVFQRWOACTFMQPLYHI(55x3)(14x1)KUTCZEZNWSISPL(8x7)YNZXWQMY(6x1)EZVHCC(6x3)AEVYOO(2x6)DE(68x6)(13x3)KRBXMIIHZERUV(3x2)TLR(35x4)LWCSHQCLMZAPMNSXKWCGVGDTKWUQAIWWLWU(17x11)FWYFWEMLVLQQGCJLJ(176x8)(4x2)ICOL(63x7)(37x14)SQVVGHBVLPVSLAYFZBLEGOKEHFSXSVEJOSRXO(2x2)IF(6x10)APYCKZ(73x15)(20x3)EARRAATGOHPONSTXOUVI(20x4)GBRNRAGYDCTGEODHJDUB(1x2)Z(1x15)R(3x4)QBQ(1x2)M(7x6)KJQAHCJ(24x6)UHLVTEERAYIUBGMUKOJFHRUJ(36x7)(30x2)(1x14)H(17x1)BSZIJHGVILXXURQDI(18x12)PSFBREKMLZRFFFRLZG(236x1)(52x7)(2x12)WK(16x10)CRNLMDQWZECYSFOT(3x10)ISI(6x13)FPJKZE(7x9)XOCUXIU(125x5)(105x5)LPOXYLAWSIIRQDNUWVHOLUDYOZSCFNCORKVFMSYIMMNCMNSOUGJHSBYKITYGFWUYHBJCQELUIMYXAFRFIAOSXSOIMGYEPJFPWQXSZYCDD(8x8)ILXIPPGD(7x13)TYZVRQS(14x12)(3x3)WXE(1x9)Q(40x10)(34x7)(2x2)AZ(10x15)UPJJICKDLA(5x6)CHXZV(153x7)(13x8)LCBGVTVMPVNMJ(30x8)(6x8)KXMWXG(6x1)DJRTOU(2x15)FW(79x10)(13x9)RIFNFQDLAWBSQ(3x2)ERQ(19x1)TTHLBYCOPMTXIIDSBXX(9x14)SBPSPMMCK(7x8)MKNEMLA(6x11)YPDDWG(220x9)(65x3)(2x6)LT(13x3)XFOPJCJBLRXYH(8x5)BKPDBCLE(6x2)UNKPOA(9x15)THYQVMZUG(50x15)(9x11)AAXOWDYIN(12x14)IWTCMNVXNJAX(10x4)JPSIYYKGVJ(86x8)(29x10)ORMIZOTUMSVKNEJDCQDQHESLAQKOF(8x14)SHFMBHHV(1x9)L(14x2)QQHGYTMVZAZRDK(5x7)COVRS(51x2)(11x2)ZDTVQIWFFND(5x8)RQTFS(1x9)B(5x9)SINCP(3x3)ACU
\ No newline at end of file
diff --git a/src/bin/day09.rs b/src/bin/day09.rs
new file mode 100644
index 0000000..fb3046f
--- /dev/null
+++ b/src/bin/day09.rs
@@ -0,0 +1,87 @@
+use std::io::{self, Read};
+use std::str::FromStr;
+
+struct Chunk {
+    data: String,
+    repeat: u32,
+}
+
+impl Chunk {
+    fn len(&self) -> usize {
+        self.data.len() * self.repeat as usize
+    }
+
+    fn parse(s: &str) -> Result<(Self, &str), ()> {
+        if s.starts_with('(') {
+            let mut iter = s[1..].splitn(3, |ch| ch == 'x' || ch == ')');
+
+            let len = iter.next().ok_or(())?.parse().map_err(|_| ())?;
+            let repeat = iter.next().ok_or(())?.parse().map_err(|_| ())?;
+            let (data, rest) = iter.next().ok_or(())?.split_at(len);
+
+            let chunk = Chunk {
+                data: data.to_owned(),
+                repeat: repeat,
+            };
+
+            Ok((chunk, rest))
+        } else {
+            let paren = s.find('(').unwrap_or(s.len());
+
+            let chunk = Chunk {
+                data: s[..paren].to_owned(),
+                repeat: 1,
+            };
+            let rest = &s[paren..];
+
+            Ok((chunk, rest))
+        }
+    }
+}
+
+struct File {
+    chunks: Vec<Chunk>,
+}
+
+impl File {
+    fn len(&self) -> usize {
+        self.chunks.iter().map(Chunk::len).sum()
+    }
+}
+
+impl FromStr for File {
+    type Err = ();
+    fn from_str(mut s: &str) -> Result<Self, ()> {
+        let mut chunks = Vec::new();
+
+        while !s.is_empty() {
+            let (chunk, rest) = Chunk::parse(s)?;
+            chunks.push(chunk);
+            s = rest;
+        }
+
+        Ok(File { chunks: chunks })
+    }
+}
+
+fn solve(input: &str) -> usize {
+    let file: File = input.parse().unwrap();
+    file.len()
+}
+
+fn main() {
+    let mut input = String::new();
+    io::stdin().read_to_string(&mut input).unwrap();
+
+    println!("Part 1: {}", solve(&input));
+}
+
+#[test]
+fn part1() {
+    assert_eq!(6, solve("ADVENT"));
+    assert_eq!(7, solve("A(1x5)BC"));
+    assert_eq!(9, solve("(3x3)XYZ"));
+    assert_eq!(11, solve("A(2x2)BCD(2x2)EFG"));
+    assert_eq!(6, solve("(6x1)(1x3)A"));
+    assert_eq!(18, solve("X(8x2)(3x3)ABCY"));
+}