Limits
1s, 512 MB

This problem is matching brackets, but with regular expression.

Given a set of parenthesis, if they are balanced, print it. If not, leave the output empty.

A line with a set of opening and closing parentheses. There will be at most 200 parenthesis.

If the entire set of parentheses is balanced, the output should contain the entire set of parentheses. Otherwise, the output should be empty.

Input | Output |
---|---|

(()) | (()) |

Input | Output |
---|---|

()() | ()() |

Login to submit.

25%
Solution Ratio

jackal_1586Earliest,

jackal_1586Fastest, 0.0s

jackal_1586Lightest, 5.7 MB

jackal_1586Shortest, 24B

Toph uses cookies. By continuing you agree to our Cookie Policy.