#include<bits/stdc++.h>
using namespace std;
string st;
int p=0,len;
string func(){
string ret;
while(p<len){
if(st[p]==']'){
return ret;
}else if(st[p]=='['){
p++;
string num;
while(st[p]>='0' && st[p]<='9'){
num+=st[p];
p++;
}
int n=stoi(num);//就是这行的问题
string s=func();
for(int i=0;i<n;i++){
ret=ret+s;
}
}else ret+=st[p];
p++;
}
return ret;
}
int main(){
cin>>st;
len=st.length();
cout<<func();
return 0;
}