Help me out in this problem


it is giving tle

https://codeforces.com/problemset/problem/1076/A

@mr.encoder are u there ?

Yes i am understanding question and your logic. Be patient

@mr.encoder okay bro

In the output format, every answer should be in a new line. Add endl while printing your string f. And submit it, it might get accepted.

@mr.encoder it is giving same error

@mr.encoder any error in logic?

It might be some error in the logic. Let me omit your code and I’ll share it with you .

@shivammishra20121999 see this code https://ide.codingblocks.com/s/362536
i have added comment to, what was wrong with your code was not handling string stl properly. And also your logic wasn’t correct i have edited your code here https://ide.codingblocks.com/s/362539

@mr.encoder hat was the error in my code?

@mr.encoder the logic is same bro

what i have edited in your code was if statement in your first for loop , i wasn’t able to understand your logic so when i have given an input of second example in the given question it wasn’t giving the correct output.