#include<bits/stdc++.h> using namespace std; string ex(){ string s="",X; char c;int D; while(cin>>c){ if(c=='['){ cin>>D; X=ex(); while(D--) s+=X; } else if(c==']') return s; else s+=c; } return s; } int main(){ cout<<ex(); return 0; }