adventofcode/2016/09/1.pl

13 lines
225 B
Perl
Raw Normal View History

2018-01-25 17:17:56 +00:00
use 5.20.0;
my $compressed = <>;
chomp $compressed;
my $decompressed = '';
while( $compressed =~ s/^(.*?)\((\d+)x(\d+)\)// ) {
$decompressed .= $1 . ( substr $compressed, 0, $2, '' ) x $3;
}
say length $decompressed;