]> www.fi.muni.cz Git - aoc2020.git/blob - 10.pl
Task 9 Perl Golf-style
[aoc2020.git] / 10.pl
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 my @seats;
6 while (<>) {
7         chomp;
8         y/FBRL/0110/;
9         my $seat =  eval "0b$_";
10         $seats[$seat] = 1;
11 }
12
13 for (1 .. $#seats-1) {
14         print $_, "\n" if $seats[$_-1] && $seats[$_+1]
15                 && !$seats[$_];
16 }