P1928 外星密码
#include<bits/stdc++.h>
using namespace std;
string Read ()
{
int num;
string s="",s1="";
char c;
while (cin>>c)
{
if (c=='\n'||c==' ')
return s;
if (c=='[')
{
cin>>num;
s1=Read ();
while (num--)
s+=s1;
}
else
{
if (c==']')
return s;
else
s+=c;
}
}
return s;
}
int main ()
{
cout<<Read ()<<endl;
return 0;
}
把第8行的cin>>c改成c=getchar()第九组会MLE,求问原因。