aboutsummaryrefslogtreecommitdiff
path: root/challenge-262/2colours/php/ch-1.php
blob: c714bc23631f34957c0cf41ea72221747f9b1e02 (plain)
1
2
3
4
5
6
7
<?php

const PARENS = ['(', ')'];
const SQUARE_BRACKETS = ['[', ']'];
echo '@ints = ';
$ints = json_decode(str_replace(PARENS, SQUARE_BRACKETS, fgets(STDIN)));
echo max(...array_map(fn ($pred) => count(array_filter($ints, $pred)), [fn ($x) => $x > 0, fn ($x) => $x < 0]));