题目链接
https://www.luogu.com.cn/problem/P1928
点这里
Code
简单易懂的代码答案
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;
string dg(){
int cnt;
string s="",ss;
char c;
while(cin >> c){
if(c=='['){
cin >> cnt;
ss = dg();
while(cnt--)s+=ss;
}
else {
if(c==']')return s;
else s+=c;
}
}
}
int main(){
cout << dg();
return 0;
}
真不错!