11 lines
329 B
PHP
11 lines
329 B
PHP
<?php
|
|
|
|
$input = file('input', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
|
$input = array_map(fn($line) => explode(' ', explode(' | ', $line)[1]), $input);
|
|
|
|
$digits = 0;
|
|
foreach ($input as $segments) {
|
|
$digits += count(array_filter($segments, fn($segment) => in_array(strlen($segment), [2,4,3,7])));
|
|
}
|
|
echo $digits; //303
|