0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-25 20:52:27 +00:00
OI-codes/Luogu/P1928/P1928.cpp

34 lines
517 B
C++
Raw Normal View History

// https://www.luogu.com.cn/record/38657002
#include <bits/stdc++.h>
using namespace std;
string cnm() {
2021-11-19 09:01:13 +00:00
int n;
char ch;
string s = "";
string str = "";
while (cin >> ch) {
if (ch == '[') {
cin >> n;
str = cnm();
while (n--) {
s += str;
}
2021-11-19 09:01:13 +00:00
} else if (ch == ']') {
return s;
2021-11-19 09:01:13 +00:00
} else {
s += ch;
}
}
return s;
}
int main() {
cout << cnm() << endl;
return 0;
}