求大佬帮看,谢谢!!
#include <iostream>
using namespace std;
char c;
int n;
string read(){
string s = "", s1;
while (cin >> c) {
if (c == '[') {
cin >> n;
s1 = read();
for (int i = 1; i <= n; i++)
s += s1;
}
else if (c == ']') {
return s;
}
else {
s += c;
}
}
}
int main () {
cout << read();
return 0;
}