How to deal with strings in this case?

since in this case no constraints are given,so i tried using strings .How to write code with strings in this question.?

hi @2020uec2022 dont pass string with ref, also u need to backtrack manually by pop_back()
updated

https://ide.codingblocks.com/s/679564 still test cases not passing

Hi @2020uec2022 I’ve given th code after testing please check

where is the code ?


@2020uec2022

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.