check for bracket validity rules [A]()[B]->[A][B] input (()(()()))