My solution not working on all test cases

When I unlocked the test cases, and run that case on my code manually, then it gave the exact answer as it was in the solution of that test case.

See the image below for More Clarification.:point_down::point_down:

Thank you🙏

My Code -> https://ide.codingblocks.com/s/469744

output should be reset after each testcase
otherwise new answer will be appended to previous output

so declare output inside while loop
or initialize it with empty string before after each testcase

Modified Code

i hope this help
if not feel free to ask

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.