0
write a Python program to split it into groups of perfectly matched parentheses without any whitespace
(---Without using function----) Input:Â ( ()) ((()()())) (()) () Output: ['(())', '((()()()))', '(())', '()'] Input:Â () (( ( )() ( )) ) ( ()) Output: ['()', '((()()()))', '(())']
2 Answers
+ 1
Hint: stacks sre usually good for this. You could also use a left counter and a right counter
0
Please link your attempt