697. Remove Outermost Parentheses

0

Easy

A valid parentheses string consists of either an empty string, a string enclosed in parentheses, or the concatenation of two valid parentheses strings. For example, "", "()", "(())()", and "(()(()))" are all valid parentheses strings. A valid parentheses string is considered primitive if it cannot be split into two nonempty valid parentheses strings. Given a valid parentheses string s, the task is to remove the outermost parentheses of every primitive string in the primitive decomposition of s.

Input Format

The input consists of a single line containing a string S.

Output Format

Print the string S after removing the outermost parentheses of every primitive string in the primitive decomposition of s.

Example

Input

(()())(())

Output

()()()

Constraints

1 <= s.length <= 10^5
Loading...

View Submissions

Console