Wrong anwer in 2 test cases out of 9

please check my code