Welcome to ZOJ
Information
Problems
Runs
Statistics
Ranklist
Clarification
52 - Andrew Stankevich's Contest, Warmup - 1001
Brackets

Time Limit: 2 Seconds      Memory Limit: 32768 KB

Given a string consisting of brackets of two types find its longest substring that is a regular brackets sequence.

Input

There are mutiple cases in the input file.

Each case contains a string containing only characters ‘(’ , ‘)’ , ‘[’ and ‘]’ . The length of the string does not exceed 100,000.

There is an empty line after each case.

Output

Output the longest substring of the given string that is a regular brackets sequence.

There should be am empty line after each case.

Sample Input

([(][()]]()

([)]

Sample Output

[()]



Submit    Status