这道题我的代码明明和题解1的基本一样,可全是RE,我又试了一下题解1的,也是RE,为啥???
#include<bits/stdc++.h>
using namespace std;
string read()
{
char c;
int num;
string x,s;
while(cin>>c)
{
if(c=='[')
{
scanf("%d",&num);
s=read();
for(int i=1;i<=num;++i) x+=s;
}
else if(c==']') return x;
else x+=c;
}
for(int i=0;i<x.size();++i) cout<<x[i];
}
int main()
{
read();
return 0;
}