My issue
When I submit the code with the same logic in Python I get the right answer, but when I do so in PHP I get the wrong answer. I’m not sure why this is happening.
My code
<?php
$t = readline();
for($i = 0; $i < $t; $i++) {
$vars = explode(' ', readline());
$lang = 0;
if($vars[0] == $vars[2] or $vars[0] == $vars[3]) {
if($vars[1] == $vars[2] or $vars[0] == $vars[3]) {
$lang = 1;
}
} elseif($vars[0] == $vars[4] or $vars[0] == $vars[5]) {
if($vars[1] == $vars[4] or $vars[1] == $vars[5]) {
$lang = 2;
}
}
print($lang . PHP_EOL);
}
Problem Link: PROGLANG Problem - CodeChef