我的代码:
#include <bits/stdc++.h>
using namespace std;
int timetimetime;
char ch;
string fz(){
string ans = "", X = "";
while((ch = getchar()) && (ch != '\n')){
if(ch == '['){
scanf("%d", &timetimetime);
X = fz();
for(int i = 1; i <= timetimetime; i++)
ans += X;
}else{
if(ch == ']')
return ans;
ans += ch;
}
}
}
int main(){
cout << fz();
return 0;
}
我想请教一下大佬们!
https://www.luogu.com.cn/record/129826742