The code is correct and It gives the solution too, but I am not able to satisfy all the conditions. why?