本蒟蒻很菜,只有四十分
#include<bits/stdc++.h>
#define int long long
using namespace std;
string a;
int y,o;
bool b[1000005];
string f(int u){
int n;
string s="",ss;
for(int i=u;i<y;i++){
if(b[i]==1)continue;
b[i]=1;
o=max(o,i);
if(a[i]>='0'&&a[i]<='9')continue;
if(a[i]==']')return s;
if(a[i]=='['){
i++;
while(a[i]>='0'&&a[i]<='9'){
b[i]=1;
n=n*10+a[i]-'0';
i++;
}
ss=f(i);
while(n--)s+=ss;
}
else{
s+=a[i];
}
}
}
signed main(){
cin>>a;
y=a.size();
cout<<f(0);
while(o!=y-1){
cout<<f(o+1);
}
}