#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
string dx(){
int d;
char c;
string s = "", tmp;
while (cin >> c){
if (c == '['){
cin >> d;
tmp = dx();
while (d--) s += tmp;
}
else if (c == ']') return s;
else s += c;
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
cout << dx();
return 0;
}
06-30
663