Please help! WA in CODEY305

the problem (CODEY305 CodeChef: Practical coding for everyone )
is showing wrong answer in each submission of mine .
My code is (CodeChef: Practical coding for everyone). Please guide me.

Also i am surprised that all the submission to this problems in c and C++ 14 are failed in past . successful submissions are only in java .

Perhaps I’m misunderstanding the question, but what should the output be for:

ab ba ab ba


I believe it should be

ab ba ab ba

You are only required to remove “instances of words that are repeated more than once continuously


Good, that’s what I thought :slight_smile: The OP’s output is:

1 Like
Why does this solution show WA? It seems to work for all the testcases I provided it

Also, I think there’s an empty line in the testcases, because this solution shows SIGSEGV

I can’t see anything immediately wrong with it, but it will fail if there is more than one space at the end of the first line (i.e. after the number N).


Ohhh, I see, thanks a lot!

sir but according to given constraint in the problem. we dont expect a double space after a line.
so, should i assume that my code( CodeChef: Practical coding for everyone ) is giving WA simply because of wrong test case in problem ?

Yours is giving the wrong answer for the testcase I posted above.

It wouldn’t surprise me if there was a bunch of extra whitespace in the testcases, either - external contests are often sloppy like that.

1 Like