From 51508d91c08dadbe6bb73b0e27779c43ecc08f93 Mon Sep 17 00:00:00 2001 From: Lars Martens Date: Sat, 11 Dec 2021 10:49:44 +0100 Subject: [PATCH] Day 10 --- input/10-test.txt | 10 +++++ input/10.txt | 106 ++++++++++++++++++++++++++++++++++++++++++++++ src/bin/10.rs | 97 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 213 insertions(+) create mode 100644 input/10-test.txt create mode 100644 input/10.txt create mode 100644 src/bin/10.rs diff --git a/input/10-test.txt b/input/10-test.txt new file mode 100644 index 0000000..b1518d9 --- /dev/null +++ b/input/10-test.txt @@ -0,0 +1,10 @@ +[({(<(())[]>[[{[]{<()<>> +[(()[<>])]({[<{<<[]>>( +{([(<{}[<>[]}>{[]{[(<()> +(((({<>}<{<{<>}{[]{[]{} +[[<[([]))<([[{}[[()]]] +[{[{({}]{}}([{[{{{}}([] +{<[[]]>}<{[{[{[]{()[[[] +[<(<(<(<{}))><([]([]() +<{([([[(<>()){}]>(<<{{ +<{([{{}}[<[[[<>{}]]]>[]] diff --git a/input/10.txt b/input/10.txt new file mode 100644 index 0000000..9f2006d --- /dev/null +++ b/input/10.txt @@ -0,0 +1,106 @@ +<<{(({<{[<[{<<<><>>{[]()}>[[{}<>]{[]{}}]}<<<{}<>>[(){})>[[<>{}]]>]>]<{((((<>{})([]{}))[[<> +[({[(<[{<(({({[]<>}){({})<{}[]>}}{[{[]<>}{()[]}]((<>[]))})[({{{}()}([]{})}[[[][]]{{}<>}]){[({}<>)<[][]>]{[[ +{<<[<<<<[[<[<<()><[]{}>>([<><>])][<[[]()]({})>{<<><>><<>()>}]>]<<{{<[]<>><<>>>(<{}[]>[[]<>])}{<(()<>)<{}()> +[({{{[((<[[{<(()<>){<>()}>}[[({}{})<(){}>]<([]{})>]]]((<((<>())<[]{}>)<<<>>[[][]]>>{[[<>{}][( +[{<([{[([<[{[<()[]>{[]{}}](<{}<>>(()[]))}({(<>())[()()]}{[{}<>]{<><>}})]({(([]{}){{}<>})})>[{([{[ +<({[[[({[[[{({{}[]}<[]{}>){{{}[]}[[]()]}}<(<{}[]>[{}<>])(<()<>>[[]{}])>]{(<{{}<>}[<><>]>((<>())({}[])))<<<() +<((<([{([{<<<[()()]<{}[]>><([]<>)([]<>)>>(({[]()}<{}[]>)(<()[]>(()())))><[<[<>{}](<>[])>(<{}<>>{[]{}})]>} +(<(({{[<<[[((<{}[]>(<>{}))(<<>()>({}<>)))[<([]{})<{}[]>><{[]<>}>]](<<([]<>)[[]]>({()[]}[<>])>{([ +<<((<<{[[(<{{[<>[]}([]{})}({[]<>}[()[]])}{[({}{}){[]<>}]<<()<>>{<><>}>}>{({{{}()}<[]<>>}<(<>[]){ +({([(([({[((((()<>){[]<>>))[<{[]{}}[[][]]>[(<>{})<{}<>>]])([{[{}<>]}<(()<>){[]{}}>]<[{[]<>}<[]>]<{( +([{{({(([[[<{[()()]{{}()}}{{()<>}<{}()>}><((<><>)<()[]>)<[<><>][[]<>]>>]<{<([][])({}<>)><{<>[]}{<>}>}{(<{}{ +{{([{[(<[[<{<{[][]}(())>([(){}]{[]<>})}[([[]{}]{[]{}}){(<>())<[]{}>}]>{{<[()[]]{{}{}}>}[(([]<>)<[]<>})]}] +[({{<([([[{([{<>[]}]<<()[]>>){[<(){}>[[]<>]][{{}<>}<<><>>]}}]<[[<[<>{}](<>{})>{{<>{}}<<>()>}]] +<(<<((<<{[{((({}[])[<>{}])[{()()}{[]<>}])}]}>[{{<[<[()()][[]{}]>[([]())<<>[]>]]{([[][]][{}()])(([]<>)( +<<[({{([([({[{()[]}[<><>]]{[<><>]({}<>)}})([<(<>())><{{}()}>][{<<>><[]()>}<({}{})({}<>)>])] +[[<((<[<{<<<(<{}()>{[][]}){<[]<>>({}{})}><<[(){}]{{}{}}>>>>}([{{{{()()}}}<([<>[]]<<>>]<{(){}}> +{<[[[(<<([{{[[{}[]>]}}])[[{<<<()<>>({}{})>(<{}{}><<>()>)>}]{[([(()[])[[][]]]<<<>{}><[]<>>>)<<{(){}}< +([[<<((<[(([<{()<>}<{}[]>><(()[])>]([<(){}><{}{}>](<<>[]><[][]>)))<{<(()[])>({<>{}})}{((()[]){[]{} +{<[([(<({(<(({{}[]}([]<>})(([]<>)[{}{}]))<(<<>[]><{}<>>)<({}{}){<><>}>>>)(<({((){})[{}{}]}<<<>()>[[] +{<[({(<{[[[[[<()<>>[[][]]]{[{}<>]{[]<>}}][([()[]]<()[]>)[<[][]>]]]](<({(()())[<><>]}<{<>}({}<>) +(<([[[[[(((<[{{}{}}{(){}})>))(({<<(){}>[{}()]>}<[(<>{})]([{}{}]<[]>)>)([{[{}()]<{}<>>}][<{<>{}}(<>{ +{((<[(([{{[<<<[]{}>{()<>}>>({[{}<>]<{}<>>}(<<>[]><[]<>>))][[[[[][]]{{}()}][<[][]>]]]}<(<<{ +<{[<{<<{<(((((<>[]][[][]]){[<><>]})(<([][])>)))([([{<>}(()[])]{(()<>)(()<>)}){{[{}{}]}}])>}>{[<< +<{((<<<[({[{[(()<>)((){})]}[{[<>{}]{{}{}}}(<{}()>(()<>))]]}(<{[[<>[]]](<()()><<>()>)})({<<[][]>[[] +(<[(<{(<[({[(<(){}>([][]))<(()())[<>{}]>]{<{()<>}<(){}>><{{}{}}({})>)}<<{{{}[]}(())}[({}())< +[{{[[{{<<([[([[][]](<><>))<{<>[]}<()[]>>]][<[[<>[]](<><>)]{[[]()]<{}()>}>[<([]{}}<{}()>>{(()()){<>()}}]] +[(<(<{{{[([(<{{}{}}<{}{}>>[[<>[]][(){}]])<(({}())[{}{}]>((()[])([]()))>])[(<{<{}{}>}>{{([][])([][] +[(<<{<(<(<(<<[()()]({}{}}>{([]{})[()<>]}>)>)><{({{(<<>[]>){(()[])({}())}}((<{}[]>{<>[]})([()<>][< +{{<<[(<{<{{([((){})[[]<>]]{([]{})([]()}})<[<{}<>>([]())]{<[]()>{{}[]}}>}{<{<[]{}>{()[]}}(<{}[]>[[]{}])> +<{[[{[({<[(({(<>{})[()[]]}{[()[]]<[]()>}))(([(<>[])<()()>])({<()[]>(()[])}))]<[[{{[]}(<>{})}[[()[]){[]< +(((([<{(({<<[{{}()}][{{}{}}<<><>>]>>((([<><>]<<>{}>)[(()())[<>[]]]))}{[<({()[]}[()[]])<([]())<{ +(<<{[({[<((<[([]<>){(){}}]{<()()>[(){}]}>(<[{}[]][()<>]>{([][]){[][]}})){{{<()[]><<>()>}(({}<>)<[]{}> +<{[[[{[<({[{((()<>)(<>[]})<{()[]}{()<>}>}[{<<>()>[{}[]]}<[()()][[][]]>]]}{<[<{<>()}<[]<>>><[()[ +([[{<{[{{{{(<<<>()>>[(())<[]>]){[[{})]<({}()){<>[]}>}}((<[<>]<{}()>>{[()()]<()()>}))}{[[{{{}<> +[(<({<{{<[{<[[<>{}]({}())]]}]{({{[<><>](()())}([{}])}[[<<>()>({}<>)]<[<>][[]()]>])[{[[()[]][<>]]}[ +{([{<[<[{[(<<{<><>}[<>()]>(((){})(()()))>[<<{}()>[<>{})>]){<<<[]<>>[[]<>]>{{<>{}}{(){}}}>([[()()][{}[]]](< +{{(([<{[{<({<({})[[]<>]>([[]]<{}{}>)}([[()()]<{}{}>])){{{{[]<>}<[]<>>}<(<>())<<>()>>}}>}]} +(<[{{<({{(<([[[]<>]]{{{}()}([]<>)})<(([][]))>>{[{{(){}}<[][]>}[[()]<()()>]](({[]{}}(<>())))})( +({{[{{[{({[(<(<>{})<(){}>><<[]{}>[[][]]>)[((()[])(()<>))]]<([[(){}]{[]<>}]<<()[]>([]<>)>)>}[{[{[()<>]}<< +(<[<<<([{{{[<([][])<(){}>>{<<><>>(<><>)}]{((()<>)<{}{}>)[{<><>}<[]<>>]}}}(([<{{}{}}{<><>}>]{{[{}() +({[[((([[<<([{(){}}(<><>)](<{}{}>{[]{}}))(<<[]()>([])>([[]{}]({}{})))><{{[[][]]{[][]}}({()[]})}{(([]<> +({<<({<[[[[[{<()<>>}({<>()}[<>[]])]]]<{{[[{}()](()())]}({([]())})}>]<({<<{(){}}<{}{})>((()[ +((<{[<{<{<[[[<[][]>{{}()}]][({<><>}{()[]})<<[]()>(()<>)>]][[(<{}{}>({}))(({}<>){[]()})][[{()[]}(()[])]{(<> +<<<[(<{<{<(<<[<><>](()[])>([[]<>]<[]{}>)>)((<{<>{}}[{}<>]>[{{}()}(()<>)])[{(<>{}){()()}}])><({{{< +<<<{[([[(({<<{<>{}}>[<<><>>(<><>)]><([[]()][{}<>])<[{}{}]>>})<<<[[{}<>](<>())><(()[]){<>()}>>([( +[{{[(<<({[{{(([]{}))[[{}()]<[]{}>]})(([{[]{}}<{}[]>]<<()[]>>)<({(){}}[[]()])<{<>()}[[]<>]>>)]} +(<[[[<[<{[[[{{()<>}[{}<>]}[(<><>)<<>{}>]]]<<[(()<>)<[]{}>]{{{}<>}(()())}><<{[]<>}[[]{}]><{<>{}}{<>{}}>>>][ +(((({<(<[{<{<(<>{})(<><>)>{(<>[])[()[]>}}[[(<>[])({})](<{}[]><{}()>)]>(<<[[]<>]({}())>(({}{})<{}{}>)> +{(([<[[<({<[{({}())<<>()>}{[{}()]<()[]>}]>(([{(){}}{()[]}])(<[[]{}][{}()]>[({}{})<{}{}>])}}(<([{()[] +[{<{{({({{<({<<>[]>[()()]>[{[]{}}([]{})])([(<>())[[][]]]([{}()](()<>)))>(<({<>[]}{<>{}})>([(()[])]))}} +{{({({[{([[{[[()[]][[]{}]][{[]<>}(<>{})]}{{[()()][[]()]}[<<>[]>((){})]}]])}]}<{[[{[((<{}{}>[(){}] +[{[({[[(<<{{[(()<>){{}()}]}<([{}])({{}{}}{<>()})>}<[[[{}[]]<<>{}>][[{}[]]([]())]]>>((<({(){}}<[]>){<{}()> +[([[<<[{[(([[{<>{}}]]}){(([{<>[]}])[([(){}]{<>[]})({{}{}}[(){}])])}]}]({<[{<{[(){}]<()()>}([< +{[[[({[[{<({{({}[]]}<(()<>)>}[([[][]])({{}{}}[[]()])])><([{<<>[]><{}<>>}(({}<>))][({<>}({}<>))])(<{([][])[()[ +([{<{{<(<[{<[(()[]){{}()}]{(()())[<><>]}>}(<<<()<>>{<><>}>[(()[]){()<>}]>[{{()()}<[][]>}])]>)(<<[ +[<(<({[[[{({([<>[]]<()<>>)[{[]()}]})<[[[[]<>]<{}<>>]([()[]){[]()})]{([{}<>][<>[]])[{()()}([ +([<[{[(<[{[(([<>[]]<<>[]>))][({(<>())({}<>)}<<()()>[{}()]>][[([][]){<>()}]({[]{}}<{}[]>)]]} +[(((<[{<{{([[[{}]<()<>>]<{()<>}([][])>]){(<{{}()}{{}{}}>(<<>{}>{{}<>})){{([][]}{{}<>}}[[[][]][[]<>]]}}} +[<[{([(<(<<{<(<>{})<{}<>>>{(<>)({}[])}}><([(<>()}[<>{}]][<{}{}>[<>[]]])[{([][])<[][]>}[({}<>)({}())] +[[<<([[{[{[<((<><>){{}<>})>(<({}<>)[()()]>[{(){}}])][[((<>{})<[]()>)(({}())({}<>))]<{<{}{} +({<(({<[([{(({()<>}[[]<>])<(<><>)>)}[{[<<>()>]<({}<>)[[]{}>>}(<<{}{}>[()()]>)]])(<({({{}<>})([[]<>](<>[] +<{{{({{{{{[([([]{})({}[])]{{[]()}<(){}>})]}[[<<{[]()}<[]<>>><<{}()>((){})>>](<{{{}[]}<<>>}< +((([<{<<(<<({[<><>]{{}{}}}[{()()}{[]}])(({()()}[{}<>])[({}())<()[]>])>([<<[]{}>{{}[]}>{[<>[]](()) +((<(<[(<[[[({(<><>)[{}()]}{<(){}><{}()>})<<<[][]>{<>{}}><{{}[]}<()[]>>>]<[[[{}][[]{}]][({}{})((){})]] +[<<{[<<[{{[{<[()<>]>(<{}{}>(<><>))}<<((){})<(){}>>>]}[{(<[{}[]][{}[]]>((()<>)([]()))){{<(){}> +<{[<[{<{<{({<[{}()][[][]]>[{()<>}{[][]}]}<[([]<>)]>>}>[([{{<[]()><()[]>}{[<>{}]{[][]}}}(<[[]<>] +{<[<[(([<<({[({}())([]{})][{{}}{[]{}}]}[[<[][]>[{}[]]][[<>()]]])[[[<(){}>{()<>}]((<>{}){()[]})]]>>]{[{ +{{[{<[[{([({[[<>[]]{[]()}][[<>()](()[])]}[[(<><>)[()<>]]<([]<>)<{}>>])]<(<{{[]<>}}>[{[{}{}]< +[{{{(({(<[{(<{<>[]}<[]<>>>)}([<[<>()]<<>[]>>{<()<>>(<>{})}]<<(<><>){(){}}]{[[]<>]{<><>}}>)]>)<{[ +[[[(({<{(<<{{<<>><<>{}>}[((){})<{}[]>]}{([[]{}]<<><>>)[(<>{})]}>>[<{<{{}{}}[{}[]]>{<[]>[() +((<(({<[<[[(((<><>){{}{}})[{()[]}[{}<>]])({([][])<{}()>}<{{}()}({}[])>)]][{<({()()}{<><>})>([({}[])<<> +{{<{[([<({<[((()())<[]()>)<({}[])({}{}}>]<{({}{})<<>>}(([]{})[{}{}])>>[<[<()<>>]>((<<>{}>{() +<[{[[[<{[[<{[{<>()}][<(){}>[{}{}]]}((<[]{}>({}[])){(<>{})})>]]}>(((([<({()<>}<()>)[{{}()}<{ +[(<{[[(({({<<[(){}]{[][]}><{[]{}}([][])>>({<{}()>{<>{}}}({{}<>}<{}<>>))})<{<<({}[])>{([]())[{}{}]}>[{ +[<<{{<<<[(<[(([][])[<>[]])][<[()[]]<[][]>>]>)]{[<[{{[][])({}[])}<<<>()>(<>[])>](((<>{})<<>{}>)((<>[]) +<<{<[{((<[([{<{}()><{}{}>}{[{}{}]({}())}]{{{<>[]}<{}[]>}<<<>[]>{[]<>}>})][{[{{()[]}{()()}}({<>{}}<{} +[(<{{[{[<{<[[{()<>}(())][{{}[]}{[]<>}]][((<><>)(<>()))(<(){}>)]>(<({[]<>}(<>()))((()<>)<[]>)>{<[{ +<[(((([[{{[[({()()}((){}))]<<([]<>)[<>{}]>([{}{}]<<>{}>)>][{<[{}[]][[][]]>[<{}>[[]{}]]}{([ +{{(({[[({[<([{<><>}[[][]]]{[<>{}](<>())})>({(<{}()>(<><>))((()())[{}[]])}<<<()><{}()>>>)]}<<(([[<>{}]{[]< +({([[<[{<{[[{{[]<>}({}{})}{<[]()>{()<>}}]]}([{<[[]()]{[]{}}>{[()<>]<(){}>}}])>}[(<[{<[<><>)><[{}{ +[<[(<({<[<{[<[(){}](<>())>]([<[]<>><[][]>]<[[]<>]{{}{}}>)}>(((((()[])<{}{}>))([<(){}>[[][]]] +<({(<{[(<{([([[]()]{<>()})[({}[])(<><>)]]<({[][]}{[]()})({[][]}(<>{}))>)}>([([<(<><>)<[]()>>{[{}<>]{<> +(<<<[((<{[(({({}())<{}()>}{{{}[]}<<>{}>})<((()())[[]()]){[<>{}]}>)[{([{}()]{{}{}})[([]())[(){}]]}]] +[[<<<[(<[{((<[{}<>]{[]{}}><(<><>)([]<>)>)[<({}[])<[]()>>(<<>[]><{}[]>)]}[<<[[]{}][{}[]]>(([][ +{<[[((({[[[(<[()[]][[][]]>(<[]()>({}())))]<{{[{}<>]<<>{}>}{(()<>){()}}}{(({}[]){<>[]}){({}{})<()[]>}}>}][[ +{<{{{{<([([<{{<>()}<(){}>}[{{}}([]<>)]>[{({}())(()[])}]]<{<(<>())[{}[]]}{((){}){[]{}}}}(((<>)<[]()>)< +{<{{{{{({{({([[]<>])[<()<>>>})<({[[]()][{}[]]}({[]<>}[{}()]))[<<{}()><<><>>>{[()<>]{()}}]>}})}<[({<(<{[]()}{ +(<{[[{{<[[<(({[]()}<[]>)<[{}()]([]{})>)(<([][])(()<>)>[[()()][()()]])>][[{{(())([]<>)}<{[]()}(()<>)>>]( +[[<[{((<{[[(({[]<>}([]())))]{<{<<><>>[{}<>]){{[]()}<<>()>}><{<()()>{[]()}}<{[][]}[[][]]>>}]{<<([< +[[[<(<([(([{((()[])[[]<>]){{<>}{<><>}}}]))])>)>][(({([<([<(<()[]>{<>()})<{[]()}<(){}>>>[<{[]<>}>{{<>{}}<<> +[<(({{(<(<[<{[<>()]([][])}{{{}[]}{{}{})}>[([()<>]([]()))[{[][]}<<>()>]]](({[()<>]{{}<>}}<({}) +(<<<<([{{[{{<{{}()}[<>[]]><{()()}[<><>]>}<[[{}()]{[]<>}]{({}[])({}[])}>}]({<({(){}}{<>()})([{}()][ +({([{(<<[(({((<>())([]<>))[[[]()]<<>[])]}))]{<{{{{{}()}{[]<>}}}(<({}{})[{}[]]>)}>}>[{((<{((){}) +((<[<{<(<[((((<>[])([]{}))[{{}{}}[<>[]]]}{[[[]<>]([]{})]{(<>[])[()()]}})<{{<{}()>[[]<>]}}>]>([{[[<<>{ +<<(<{{<<<({[[([]()){[]}]{<<><>><()()>}][[[(){}]<<><>>]]}[{<[()[]]>{([]<>)}}{({()[]})}])(([{(()[] +<{[(<{[<((<[<([]())<()[]>>[({}<>)[[]{}]]]<(<{}{}>(<>{}))<({}{}){{}()}>>>[({([]())<{}()]})<<[()[]]{ +{<[<[{<{[[{<<<()[]>{()}>{<{}<>>{<>}}>}{[[([]())]{([])]][(<()[]>(()())){[{}{}](()[])}]}]]}>( +{(((<[<<{{[[(<<>{}>(()<>))][({[]{}}<{}<>>)<[<>](<>[])>]]<{([[]]{(){}})((<><>)[{}])}[{({}<>}<{}[]>}{(<>())< +[[[[[<({(<{([{[]<>}[{}[]]][{[]{}}<{}{}>])[([{}[]]<[]()>)<<<>{}>>]}>)})<(({({(([]{}))}(<[<>() +[<{<(([(<<{<(([]<>)[<><>]){<()()>[<>{}]}>}({{({}[])([]<>)}})>><([(<[()()][[]()]><[[]<>]{[][]}>)( +[<(<(<{([<(<{<<><>>{<>()}}((<><>)[{}])>)((({()<>}({}())){([]{})([]{})})(<(<>{})([]())>))><<((<( +[<<[[{[{{<([({(){}}({}()))[[[][]]]])([([[]]({}())){({}())({}{})}]<[[<><>]<<>()>]{[<>{}]{()[]}}>)><({[[()()](( +{([{(([(({({{[(){}]([])}({<>()})}{<[(){}]<<>[]>><{[]<>}[[]()]>})}))<{{[[{[()[]]<<><>>}([[]()]([]()))]]{{<[[ +{((([<[<[{{(((<>()>))[[<()()>]{([][])[{}()]}]}(([{()[]}<<><>>][<[]()>])(({{}{}}((){}))({<>() +{<(<<(<{([{{[[<>()]{{}<>}]<<<>[]>[[]{}]>}{([[][]][<>{}]){[{}()][(){}]}}}]}<{{{[<<>[]>(<>{})][[<><>]]}{ +[<<([{<({([[({{}<>}<<>{}>)((()())<{}()>)]<{(<>{})}([()()]<[][]>)>])}{[[(<<[]{}>(()<>)>{[(){}]([][])})[(( diff --git a/src/bin/10.rs b/src/bin/10.rs new file mode 100644 index 0000000..565c6c1 --- /dev/null +++ b/src/bin/10.rs @@ -0,0 +1,97 @@ +use std::collections::VecDeque; + +type Line = VecDeque; + +fn main() { + let (score, incomplete_lines) = part1(); + println!("First solution: {}", score); + println!("Second solution: {}", part2(incomplete_lines)); +} + +fn part1() -> (usize, Vec) { + let mut score = 0; + + let mut input = input(); + input.retain(|f| { + let mut stack = Vec::new(); + let mut line = f.clone(); + while let Some(next) = line.pop_front() { + if is_open(next) { + stack.push(next); + } else { + let popped = stack.pop().unwrap(); + if !is_pair(popped, next) { + // This line is corrupted. + score += char_score_invalid(next); + return false; + } + } + } + true + }); + + (score, input) +} + +fn part2(lines: Vec) -> usize { + let mut scores = Vec::new(); + + for mut line in lines { + let mut stack = Vec::new(); + while let Some(next) = line.pop_front() { + if is_open(next) { + stack.push(next); + } else { + stack.pop(); + } + } + + let mut score = 0; + while let Some(next) = stack.pop() { + score *= 5; + score += char_score_incomplete(next); + } + scores.push(score); + } + + scores.sort_unstable(); + scores[scores.len() / 2] +} + +fn is_open(c: char) -> bool { + matches!(c, '<' | '{' | '[' | '(') +} + +fn is_pair(open: char, close: char) -> bool { + matches!( + (open, close), + ('<', '>') | ('{', '}') | ('(', ')') | ('[', ']') + ) +} + +fn char_score_invalid(c: char) -> usize { + match c { + ')' => 3, + ']' => 57, + '}' => 1197, + '>' => 25137, + c => panic!("invalid char for score '{}'", c), + } +} + +fn char_score_incomplete(c: char) -> usize { + match c { + '(' => 1, + '[' => 2, + '{' => 3, + '<' => 4, + c => panic!("invalid char for score '{}'", c), + } +} + +fn input() -> Vec { + include_str!("../../input/10.txt") + .lines() + .map(|s| s.chars().collect()) + .collect() +}