longest substring with matching parens