adventofcode/2018/07/sol1.pl
Yanick Champoux fa9ba00a6b leftovers
2018-12-10 10:32:54 -05:00

23 lines
316 B
Perl

use 5.20.0;
use warnings;
use experimental qw/
signatures
postderef
/;
use Graph::Directed;
my $g = Graph::Directed->new;
while(<>) {
/Step (.).*before step (.)/;
$g->add_edge( $1 => $2 );
}
while( my @x = sort $g->predecessorless_vertices ) {
print $x[0];
$g->delete_vertex($x[0]);
}