SDE Path

Remove Outermost Parentheses

Easy

Remove Outermost Parentheses

Given a valid parentheses string, remove the outermost pair of each primitive group.

Input format

A single line containing a valid parentheses string made of '(' and ')'.

Output format

Print the string after removing the outermost parentheses of every primitive group. The result is guaranteed non-empty.

Constraints

  • Values fit in a 64-bit signed integer
  • Trailing whitespace and a trailing newline are ignored by the judge

Read from stdin, write to stdout. Sample cases below show the exact format.

Sample cases

Example 1
Input
(()())(())
Expected output
()()()
Example 2
Input
(()())(())(()(()))
Expected output
()()()()(())