#include#include #define max 9999 using namespace std; char s[110]; int ans[110][110],pipei[110][110]; void output(int x,int y) { if(x>y) return ; else if(x==y) { if(s[x]=='('||s[x]==')') printf("()"); else printf("[]"); } else { if(pipei[x][y]==-1) { printf("%c",s[x]); output(x+1,y-1); printf("%c",s[y]); } else { output(x,pipei[x][y]); output(pipei[x][y]+1,y); } } } int main() { while(gets(s)) { int dis,k,i,j; int len=strlen(s); if(!len) { printf("\n"); continue; } memset(ans,0,sizeof(ans)); for(i=0;i j找出使(ans[i,k]+ans[k+1,j])最小的K,ans[i,j]=ans[i,k]+ans[k+1,j]. { if(ans[i][k]+ans[k+1][j]