mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-05 19:38:48 +00:00
36 lines
540 B
C++
36 lines
540 B
C++
|
// https://www.luogu.com.cn/record/38657002
|
||
|
|
||
|
#include <bits/stdc++.h>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
string cnm() {
|
||
|
int n;
|
||
|
char ch;
|
||
|
string s = "";
|
||
|
string str = "";
|
||
|
|
||
|
while (cin >> ch) {
|
||
|
if (ch == '[') {
|
||
|
cin >> n;
|
||
|
str = cnm();
|
||
|
while (n--) {
|
||
|
s += str;
|
||
|
}
|
||
|
}
|
||
|
else if (ch == ']') {
|
||
|
return s;
|
||
|
}
|
||
|
else {
|
||
|
s += ch;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return s;
|
||
|
}
|
||
|
|
||
|
int main() {
|
||
|
cout << cnm() << endl;
|
||
|
return 0;
|
||
|
}
|