Can you tell whats the problem with this code.Its not passing last two test cases

Can you tell whats the problem with this code.Its not passing last two test cases

Pls share your code by saving on ide… so that I could check it…