显然是可以继承的
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
const int maxn=1000001;
char s[maxn];
int l;
int znx,jdn;
int f[maxn];
int main(){
scanf("%s",s+1);
int l=strlen(s+1);
for(int i=2;i<=l;++i){
if(s[i]=='('||s[i]=='['){
continue;
}else{
if((s[i-f[i-1]-1]=='('&&s[i]==')')||s[i-f[i-1]-1]=='['&&s[i]==']'){
f[i]=f[i-1]+2+f[i-2-f[i-1]];
if(f[i]>znx){
znx=f[i];
jdn=i;
}
}
}
}
for(int i=jdn-znx+1;i<=jdn;++i){
cout<<s[i];
}
return 0;
}