Help in solving gsub question

problem link
Solution link

Can someone help me in where I am going wrong.
@everule1 @ssjgz

Why you are complicating things.
This is my code Link
Hope so it’s understandable.

In line 47 you are doing chaining comparison:

(((a[x] == a[x + 1] == a[x - 1])))

As far as i know it is not allowed in C++, We have to do this instead:

(((a[x] == a[x + 1] && a[x] == a[x - 1])))

AC using your code and changing 1 line: Link

oh shit. I’ve lost my 65 points just because of that :expressionless:
btw thank you I was getting mad as i didn’t knew where I was going wrong.

1 Like

Tq like It was solution I wrote during live contest. So I was considering all cases.