Failing Test Case

logic is correct
but you are print space between 0 and 1 which is not mention in question

remove the spaces all testcases will passed