#include"stdio.h"
char str[100008],stack[100008];
int info[100008];
main()
{
int i,s,e,tmp,top,len,start;
while(gets(str)!=NULL)
{
s=-1,e=-1,start=-1,top=0,len=0;
for(i=0;str[i];i++)
{
if(str[i]=='['||str[i]=='(')
{
stack[top]=str[i];
info[top]=i;
top++;
}
else if(top&&(str[i]==']'&&stack[top-1]=='['||str[i]==')'&&stack[top-1]=='('))
{
top--;
if(top!=0)tmp=info[top-1];
else tmp=start;
if(i-tmp>len)
len=i-tmp,s=tmp,e=i;
}
else
{
start=i;
top=0;
}
}
str[e+1]='\0';
puts(str+s+1);
getchar();
putchar('\n');
}
return 0;
}
09-11
09-11
09-11