Distribute by kou

l[20],r[20],a,b,i,j,m,n;main(v,s){char*p;for(;p=gets(s);puts("])")){for(a=b=m=n=0;*p-93;a>b?b+=r[n++]=v:(a+=l[m++]=v))v=strtol(p+1,&p,10);for(i=j=0;j<n;i<m?i++:j++)printf("%s%d",i?i<m||j?",":"],[":"([",i<m?l[i]:r[j]);}}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page