Leetcode strings

I am not being able to do this.Please help me in implementation

The idea is to maintain two flag variables, one to indicate that a single line comment is started, another to indicate that a multiline comment is started. When a flag is set, we look for the end of comment and ignore all characters between start and end.

Can you plz show me the implementation

My Code

but there is an error in the question


Correct Output


Output acc to leetcode


that is the reason they got such a response


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.