Failed test case

My code works perfectly for the sample input, and I have handled all the constraints in the question. Still, my code failed to pass test case 3. Kindly tell me where I made a mistake in the code.

hi @f20201011,
please refer this ive commented https://ide.codingblocks.com/s/657459