C - Longest Regular Bracket Sequence