the out put is always right with different test cases