CHEFSIGN WA in some cases

Which test cases am I missing here?
https://www.codechef.com/viewsolution/14592888
Thanks

PS: Please upvote the question so that I get proper reputation for upvoting other answers. Thank You.

1 Like

what if the test case is
β€œ<<<<”
or
β€œ>>>>”
your loop stops when u get another sign!!
but what if u dont get any?

my solution!!
https://www.codechef.com/viewsolution/14422984

hope this helped you

Take a look at this solution may be this will help you Out Solution LINK

If this helps , you have to count the longest consecutive subsequence of same characters (other than =)

Here are some test cases

My output:

2

2

2

2

3

3

2

2

2

2

Your output:

2

2

1

1

3

1

2

2

2

2

Code is working fine on this test case. It’s giving 5 as the output.

His logic is almost correct. He is missing on very few edge cases, which i assume are repeated in those test cases.

Your int k has been left undefined in this case, which occasionally may equate to word.size() (especially if the last string has the same length as the current string) and terminate your loop early when the test case start with an β€˜=’. Set int k = 0; and you should pass the test cases.

That was surely a really very silly mistake. Code is working perfectly now!