代码运行的时候不输出答案,但提交AC了。求助dalao为什么QAQ
#include<bits/stdc++.h>
using namespace std;
string expand(){
string s="",X;
char c;int D;
while(cin>>c){
if(c=='['){
cin>>D;
X=expand();
while(D--) s+=X;
}
else if(c==']')
return s;
else s+=c;
}
return s;
}
int main()
{
//freopen("p1928.in","r",stdin);
//freopen("p1928.out","w",stdout);
cout<<expand();
return 0;
}