Problem with my code

I have approached this like the hint video provided. It is working for sample cases. However it gives wrong answer on each of the cases on submission. I don’t seem to get what I missed. Still new.

@Shubh_rmcf07 coding blocks ide is under maintenance so i am unable to get your code could you send it to me by any other ide like (https://ideone.com/) or if you know any.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.