$b[$i]) { $tooLittle = $i; } } return [ "tooMany" => $tooMany, "tooLittle" => $tooLittle, ]; } function sub() { $a[0] = 20104; $a[1] = 20063; $a[2] = 19892; $a[3] = 20011; $a[4] = 19874; $a[5] = 20199; $a[6] = 19898; $a[7] = 20163; $a[8] = 19956; $a[9] = 19841; $in = trim(fgets(STDIN)); $len = strlen($in); $b = []; for ($i = 0; $i < $len; $i++) { if(ctype_digit($in[$i])){ $b[$in[$i]]++; } } $c = calcKey_TooManyAndTooLittle($a, $b); echo $c["tooMany"] . " " . $c["tooLittle"]; } sub();