Your output does not seem to be right.
Example:
()*()
this should give a negative result----- but your one doesn't;
the corresponding closing of the first should be the last.
Hope it helps.
![:wink:](./images/smilies/icon_wink.gif)
Moderator: Board moderators
But, I think, here () is followed by a separate character * and this sequence is followed by another ().As () is a correct sequence so, I think, ()*() should give positive answer. After all I got accepted in this way.()*()
this should give a negative result----- but your one doesn't;
the corresponding closing of the first should be the last.
How do you know these two inputs give two different outputs---((**)()a+b)[(a){a+n}](*
((**)()a+b)[(a){a+n}](
this is actually the first bracket (from left) that is out of position.And I'm not sure what this statement means?
"If the expression is not properly nested your program should determine the position of the offending bracket, that is the length of the shortest prefix of the expression that can not be extended to a properly nested expression."
Code: Select all
((**)()a+b)[(a){a+n}](
Code: Select all
NO 20
Code: Select all
NO 21
Code: Select all
((**)()a+b)[(a){a+n}](*
Code: Select all
()()(a+b)(
Code: Select all
YES
Code: Select all
[**
((((())
(*(*(*(**)*)
Code: Select all
NO 2
NO 4
NO 3
Code: Select all
No 4
No 8
No 7
Code: Select all
No 3
No 4
No 8
No 7
Code: Select all
(**
[**
((((())
(*(*(*(**)*)
Code: Select all
NO 2
NO 2
NO 4
NO 3