# chef and sign sequence

HELLO community!

i m getting WA in 2 testcases! hereis my submission

https://www.codechef.com/viewsolution/14495088

you are complicating things too much , its just to count the consecutive < or > whicheva is max

i know and i think i m doing the same thing.but somehow these two testfiles are giving WA.i tried every test case i could think and they all are giving right answer.please help!

One pretty crude but reliable way to debug your code is to generate random test cases (which is easy in this case). Just download an AC code and throw random tests at your code while comparing against the AC output. In the case where you donâ€™t have an AC code, you can (sometimes) write a brute force solution to check for small inputs.

Another way is to question your assumptions rigorously. This is harder to do than the first one but this is the only way when all other debugging alternatives have been exhausted. Try to write down every assumption that you used in your logic. Then question if each one will definitely be true. If there exist any counterexamples, then you need to rethink your logic.

Last but not least, for this problem specifically, you might want to print the actual values of the sequence which you used to satisfy the inequality. For example, if the sequence is â€ś<<â€ť, your code should output 1 < 2 < 3 not 0 < 1 < 2 or some other illegal sequence. If you see some strange value appear, then your logic definitely went wrong somewhere.

i had compared my code with AC one.but i was unable to spot any logical error in my code.

Debug using this case-

``````Input
1
<<><<<<><<<>>>>>
5
Correct Output
6 (last bracket has length 5)
``````

Your initial count1 and count 2 (which count number of â€ś<â€ť and â€ś>â€ť) have no purpose, as you can see in this test case.

thank u so much! i got my mistake nowâ€¦

Hey dear, for any question you ask, please dont use â€śAward pointâ€ť feature as this gives YOUR karma to the user, and you need 20 karma to freely ask as many Q as you want. Instead, use â€śAccept answerâ€ť feature by clicking on â€śtick in circle below thumbs down buttonâ€ť. That will give decided points to the asnwerer, adn some karma to you as well for going through answers and successfully accepting the correct one. Thats the standard way the community grows ^^

that was my first question on forum,didnâ€™t knew that!

You can always accept the answers which rightly answered your query. That way you can get enough reputation soon for asking Q yourself.

Np, many people get confused in their first time, even i was