Test Cases Failing

this is my code
Manually running the code seems to run fine but i am failing test cases. Why is it so?

you have shared the wrong code