Test cases not being passed
Swap the entire if(o<n) part with the entire if(c<o) part.
Please help me in finding the issue and how will the swapping help
This is the only issue in your code.
It just changes the order in which your output strings are displayed.
Otherwise your code is correct.
Your modified code. Check it out.
Iām still not satisfied. Please dry run and tell me if possible
Try running both the codes for input 2 and see the output.