Function advent_solutions::advent2017::day09::part2
[−]
[src]
pub fn part2(root: &Node) -> usize
Now, you're ready to remove the garbage.
To prove you've removed it, you need to count all of the characters
within the garbage. The leading and trailing < and > don't count,
nor do any canceled characters or the ! doing the canceling.
<>,0characters.let root = Node::from_bytes(b"<>") .to_result() .unwrap(); assert_eq!(part2(&root), 0);
<random characters>,17characters.let root = Node::from_bytes(b"<random characters>") .to_result() .unwrap(); assert_eq!(part2(&root), 17);
<<<<>,3characters.let root = Node::from_bytes(b"<<<<>") .to_result() .unwrap(); assert_eq!(part2(&root), 3);
<{!>}>,2characters.let root = Node::from_bytes(b"<{!>}>") .to_result() .unwrap(); assert_eq!(part2(&root), 2);
<!!>,0characters.let root = Node::from_bytes(b"<!!>") .to_result() .unwrap(); assert_eq!(part2(&root), 0);
<!!!>>,0characters.let root = Node::from_bytes(b"<!!!>>") .to_result() .unwrap(); assert_eq!(part2(&root), 0);
<{o"i!a,<{i<a>,10characters.let root = Node::from_bytes(b"<{o\"i!a,<{i<a>") .to_result() .unwrap(); assert_eq!(part2(&root), 10);
How many non-canceled characters are within the garbage in your puzzle input?