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 ответов
+ 1
Hint: stacks sre usually good for this. You could also use a left counter and a right counter
0
Please link your attempt