#include <cstring>
#include <iostream>
using namespace std;
int main()
{
char s[100];
cin >> s;
int l = 0;
int maxl = 0;
for( int i=0 ; i < strlen(s); i++ )
{
if( s[i] == '(' )
{
s[i] = '{';
l++;
if( l > maxl )
{
maxl = l;
}
}
if( s[i] == ')' )
{
s[i] = '}';
l--;
}
}
for( int i=0 ; i < strlen(s); i++ )
{
if( s[i] == '{' )
{
l++;
if( l == maxl ) s[i] = '(';
if( l == maxl-1 ) s[i] = '[';
}
if( s[i] == '}' )
{
if( l == maxl ) s[i] = ')';
if( l == maxl-1 ) s[i] = ']';
l--;
}
}
cout << s << endl;
}
I2luY2x1ZGUgPGNzdHJpbmc+CiNpbmNsdWRlIDxpb3N0cmVhbT4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpCnsKCWNoYXIgc1sxMDBdOwoJY2luID4+IHM7CglpbnQgbCA9IDA7CglpbnQgbWF4bCA9IDA7Cglmb3IoIGludCBpPTAgOyBpIDwgc3RybGVuKHMpOyBpKysgKQoJewoJCWlmKCBzW2ldID09ICcoJyApCgkJewoJCQlzW2ldID0gJ3snOwoJCQlsKys7CgkJCWlmKCBsID4gbWF4bCApCgkJCXsKCQkJCW1heGwgPSBsOwoJCQl9CgkJfQoJCWlmKCBzW2ldID09ICcpJyApCgkJewoJCQlzW2ldID0gJ30nOwoJCQlsLS07CgkJfQoJfQoJZm9yKCBpbnQgaT0wIDsgaSA8IHN0cmxlbihzKTsgaSsrICkKCXsKCQkKCQlpZiggc1tpXSA9PSAneycgKQoJCXsKCQkJbCsrOwoJCQlpZiggbCA9PSBtYXhsICkgc1tpXSA9ICcoJzsKCQkJaWYoIGwgPT0gbWF4bC0xICkgc1tpXSA9ICdbJzsKCQl9CgkJaWYoIHNbaV0gPT0gJ30nICkKCQl7CgkJCWlmKCBsID09IG1heGwgKSBzW2ldID0gJyknOwoJCQlpZiggbCA9PSBtYXhsLTEgKSBzW2ldID0gJ10nOwoJCQlsLS07CgkJfQoJfQoJY291dCA8PCBzIDw8IGVuZGw7Cn0=