0

write a Python program to split it into groups of perfectly matched parentheses without any whitespace

(---Without using function----) Input:  ( ()) ((()()())) (()) () Output: ['(())', '((()()()))', '(())', '()'] Input:  () (( ( )() ( )) ) ( ()) Output: ['()', '((()()()))', '(())']

5th Aug 2022, 7:40 AM
Jeel Bhalodiya
Jeel Bhalodiya - avatar
2 Answers
+ 1
Hint: stacks sre usually good for this. You could also use a left counter and a right counter
5th Aug 2022, 7:46 AM
John Doe
0
Please link your attempt
5th Aug 2022, 7:41 AM
John Doe