Sir, where am i doing mistake?

code -> https://ide.codingblocks.com/s/458500

i have removed all the errors
Modified code

but using this approach order of character will change which leads to wrong ans
for the input
axbxc
Your Output
acbxx
Correct Output
abcxx

Sir, is it fine regarding time complexity ? or any other efficient solution may be happen ? please tell. code-> https://ide.codingblocks.com/s/458517

this time opitmise solution but not space optimise

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.