#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
string f()
{
int k;
char ch;
string res = "";
string s;
while (cin >> ch)
{
if (ch == '[')
{
cin >> k;
s = f();
while (k--)
{
res += s;
}
}
else if (ch == ']')
{
return res;
}
else
{
res += ch;
}
}
return res;
}
int main()
{
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
cout << f();
}
06-30
674
05-16
647
09-27
1018